百科 / 函数百科 / 二进制串函数和操作符
FUNCTION二进制串函数和操作符
convert_from
将表示编码 src_encoding 的文本的二进制字符串转换为数据库编码中的 text。(适用的转换请参阅第 23.3.4 节)。
Converts a binary string representing text in encoding src_encoding to text in the database encoding (see Section 23.3.4 for available conversions).
二进制串函数和操作符 引入 8.3 现存至 20 devel 1 条签名 0 次签名变更
- 分组
- 二进制串函数和操作符
- 签名数
- 1 条
- 引入版本
- 8.3
- 状态
- 现存
- 签名变更
- 未变过
- 本版来源
- 同版手册译文
版本轨迹
相对 PostgreSQL 17 无变化。
说明
src_encoding 的文本的二进制字符串转换为数据库编码中的 text。(适用的转换请参阅第 23.3.4 节)。convert_from ( bytes bytea, src_encoding name ) → text将表示编码
src_encoding 的文本的二进制字符串转换为数据库编码中的 text。(适用的转换请参阅第 23.3.4 节)。签名
PostgreSQL 18.7 里 convert_from 的 1 条签名,按上游手册顺序排列。参数名用斜体,类型用弱化色, 之后是返回类型。中文说明来自同版本手册与审阅译文,悬停可查看每条说明的来源。
-
convert_from(bytesbytea,src_encodingname) →textconvert_from('text_in_utf8', 'UTF8')text_in_utf8
演化历史
相邻两个大版本之间的差异,新的在前。版本号链到该版的签名。
-
PostgreSQL 17 ← 16 说明更新
说明更新
-
PostgreSQL 14 ← 13 说明更新
说明更新
-
PostgreSQL 13 ← 12 手册重排
stringbinarystring这一跳手册重排了函数表的写法,签名文本整体改写,只记函数的增删,不逐条比较签名。
-
PostgreSQL 8.3 ← 8.2 新增此函数
PostgreSQL 8.3 起可用
签名矩阵
每条签名在给出了签名的 20 个版本里的存在情况;方格指向该版的签名。只在正文里提到此函数、没有给出签名的版本不列进来,上面的版本轨迹里仍然有它们。签名文本在 PostgreSQL 13 前后写法不同,跨越那一跳的同一条签名会显示成两行。
存在 不存在
| 签名 | 8.3 | 8.4 | 9.0 | 9.1 | 9.2 | 9.3 | 9.4 | 9.5 | 9.6 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
convert_from ( string bytea, src_encoding name ) → text |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 |
convert_from ( bytes bytea, src_encoding name ) → text |
不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
同组函数
| 函数 | 签名 | 主签名 | 版本变动 | 最近变更 |
|---|---|---|---|---|
bit_count |
2 | bit_count ( bytes bytea ) → bigint |
— | |
| 返回二进制字符串中被置位的位数(也称为“popcount”)。 | 现存 | |||
convert |
1 | convert ( bytes bytea, src_encoding name, dest_encoding name ) → bytea |
8.32 次 | |
| 将表示编码 src_encoding 的文本的二进制字符串转换为编码 dest_encoding 的二进制字符串(适用的转换请参阅第 23.3.4 节)。 | 现存 | |||
convert_from |
1 | convert_from ( bytes bytea, src_encoding name ) → text |
— | |
| 将表示编码 src_encoding 的文本的二进制字符串转换为数据库编码中的 text。(适用的转换请参阅第 23.3.4 节)。 | 现存 | |||
convert_to |
1 | convert_to ( string text, dest_encoding name ) → bytea |
— | |
| 将 text 字符串(数据库编码)转换为编码 dest_encoding 中编码的二进制字符串。(适用的转换请参阅第 23.3.4 节)。 | 现存 | |||
crc32 |
1 | crc32 ( bytea ) → bigint |
— | |
| 计算二进制字符串的 CRC-32 值。 | 现存 | |||
crc32c |
1 | crc32c ( bytea ) → bigint |
— | |
| 计算二进制字符串的 CRC-32C 值。 | 现存 | |||
decode |
1 | decode ( string text, format text ) → bytea |
8.41 次 | |
| 从文本表示中解码二进制数据;支持的 format 值与 encode 相同。 | 现存 | |||
encode |
1 | encode ( bytes bytea, format text ) → text |
8.41 次 | |
| 将二进制数据编码成文本表示;支持的 format 值为:base32hex, base64, base64url, escape, hex。 | 现存 | |||
get_bit |
2 | get_bit ( bytes bytea, n bigint ) → integer |
8.11 次 | |
| 从二进制字符串中提取编号为 n 的位。 | 现存 | |||
get_byte |
1 | get_byte ( bytes bytea, n integer ) → integer |
8.11 次 | |
| 从二进制字符串中提取编号为 n 的字节。 | 现存 | |||
set_bit |
2 | set_bit ( bytes bytea, n bigint, newvalue integer ) → bytea |
— | |
| 设置二进制字符串中的编号为 n 的位为 newvalue。 | 现存 | |||
set_byte |
1 | set_byte ( bytes bytea, n integer, newvalue integer ) → bytea |
— | |
| 将二进制字符串中编号为 n 的字节设置为 newvalue。 | 现存 | |||
sha224 |
1 | sha224 ( bytea ) → bytea |
— | |
| 计算二进制字符串的 SHA-224 hash。 | 现存 | |||
sha256 |
1 | sha256 ( bytea ) → bytea |
— | |
| 计算二进制字符串的 SHA-256 hash。 | 现存 | |||
sha384 |
1 | sha384 ( bytea ) → bytea |
— | |
| 计算二进制字符串的 SHA-384 hash。 | 现存 | |||
sha512 |
1 | sha512 ( bytea ) → bytea |
— | |
| 计算二进制字符串的 SHA-512 hash。 | 现存 | |||