9.5. Binary String Functions and Operators

9.5. Binary String Functions and Operators
9.5.二进制字符串函数和运算符
This section describes functions and operators for examining and manipulating values of type bytea.
本节介绍了用于检查和操作bytea类型的值的函数和运算符。
 
SQL defines some string functions that use key words, rather than commas, to separate arguments.Details are in Table 9.11. PostgreSQL also provides versions of these functions that use the regular function invocation syntax (see Table 9.12).
SQL定义了一些字符串函数,这些函数使用关键字而不是逗号来分隔参数。详细信息请参见表9.11。 PostgreSQL还提供了使用常规函数调用语法的这些函数的版本(请参见表9.12)。
 
Note
注:
The sample results shown on this page assume that the server parameter bytea_output is set to escape (the traditional PostgreSQL format).
此页面上显示的示例结果假定服务器参数bytea_output设置为escape(传统的PostgreSQL格式)。
9.5. Binary String Functions and Operators
9.5. Binary String Functions and Operators
Additional binary string manipulation functions are available and are listed in Table 9.12. Some of them are used internally to implement the SQL-standard string functions listed in Table 9.11.
其他可用的二进制字符串操作函数,在表9.12中列出。 其中一些用于内部实现表9.11中列出的SQL标准字符串函数。
 
9.5. Binary String Functions and Operators
9.5. Binary String Functions and Operators
9.5. Binary String Functions and Operators
get_byte and set_byte number the first byte of a binary string as byte 0. get_bit and set_bit number bits from the right within each byte; for example bit 0 is the least significant bit of the first byte, and bit 15 is the most significant bit of the second byte.
get_byte和set_byte将二进制字符串的第一个字节编号为字节0。 例如,位0是第一个字节的最低有效位,而位15是第二个字节的最高有效位。
 
Note that for historic reasons, the function md5 returns a hex-encoded value of type text whereas the SHA-2 functions return type bytea. Use the functions encode and decode to convert between the two, for example encode(sha256('abc'), 'hex') to get a hex-encoded text representation.
请注意,由于历史原因,函数md5返回十六进制编码的text类型的值,而SHA-2函数返回类型bytea。 使用encodedecode函数在两者之间进行转换,例如,encode(sha256('abc'),'hex')获得十六进制编码的文本表示形式。
 
See also the aggregate function string_agg in Section 9.20 and the large object functions in Section 35.4.
另请参见第9.20节中的聚合函数string_agg和第35.4节中的大对象函数。