text
变长字符串
当前查看 PostgreSQL 18。
中文定义与说明
变长字符串
同版本中文手册定义
text | 无限长度的变长 |
PG10–20 核心源码清单。类型转换与操作符类列出源码显式声明的关系;缺少记录不能排除通过其他机制进行转换或使用索引。
定义
变长字符串
text
- 目录名称
- pg_catalog.text
- 类型 OID
- 25
- 类型种类
- 基础类型
- 声明长度
- 变长(varlena)
- 存储策略
- 扩展
- 输入函数
- textin
- 输出函数
- textout
- 手册中的声明
- 文本
- 手册说明
- 无限长度的变长
系统目录属性
此构建的源码初始化值。字段含义参见 pg_type 。包含头文件默认值;依赖构建的常量保留符号形式,不作为服务器运行时实测。
oid25descrvariable-length string, no limit specifiedtypacl_null_typlen-1typelem0typnametexttypsendtextsendtyptypebtypalignityparray0typbyvalftypdelim','typinputtextintypmodin-typndims0typownerPOSTGREStyprelid0typmodout-typoutputtextouttyptypmod-1typanalyze-typdefault_null_typnotnullftypreceivetextrecvtypstoragextypbasetype0typcategoryStypcollationdefaulttypisdefinedttypnamespacepg_catalogtypsubscript-typdefaultbin_null_array_type_oid1009typispreferredtarray_type_name_text
类型转换 18
与此类型相关的显式 pg_cast 记录。PostgreSQL 还支持 pg_cast 之外的类型转换,缺少记录不能证明转换不可能。
| 源类型 | 目标类型 | 转换上下文 | 转换方式 | 函数 |
|---|---|---|---|---|
text | regclass | 隐式 | 函数 | regclass |
text | bpchar | 隐式 | 二进制兼容 | 0 |
text | varchar | 隐式 | 二进制兼容 | 0 |
bpchar | text | 隐式 | 函数 | text(bpchar) |
varchar | text | 隐式 | 二进制兼容 | 0 |
char | text | 隐式 | 函数 | text(char) |
name | text | 隐式 | 函数 | text(name) |
text | char | 赋值 | 函数 | char(text) |
text | name | 隐式 | 函数 | name(text) |
pg_node_tree | text | 隐式 | 二进制兼容 | 0 |
pg_ndistinct | text | 隐式 | 输入/输出 | 0 |
pg_dependencies | text | 隐式 | 输入/输出 | 0 |
pg_mcv_list | text | 隐式 | 输入/输出 | 0 |
cidr | text | 赋值 | 函数 | text(inet) |
inet | text | 赋值 | 函数 | text(inet) |
bool | text | 赋值 | 函数 | text(bool) |
xml | text | 赋值 | 二进制兼容 | 0 |
text | xml | 显式 | 函数 | xml |
运算符重载 58
每种操作数签名均为独立重载。实现函数和返回类型来自同一源码构建。
| 运算符 | 左操作数 | 右操作数 | 返回类型 | 含义 | 实现函数 |
|---|---|---|---|---|---|
= | text | text | bool | 等于。 | texteq |
^@ | text | text | bool | 以指定前缀开头。 | starts_with |
= | name | text | bool | 等于。 | nameeqtext |
< | name | text | bool | 小于。 | namelttext |
<= | name | text | bool | 小于或等于。 | nameletext |
>= | name | text | bool | 大于或等于。 | namegetext |
> | name | text | bool | 大于。 | namegttext |
<> | name | text | bool | 不等于。 | namenetext |
= | text | name | bool | 等于。 | texteqname |
< | text | name | bool | 小于。 | textltname |
<= | text | name | bool | 小于或等于。 | textlename |
>= | text | name | bool | 大于或等于。 | textgename |
> | text | name | bool | 大于。 | textgtname |
<> | text | name | bool | 不等于。 | textnename |
<> | text | text | bool | 不等于。 | textne |
~ | name | text | bool | 匹配正则表达式,区分大小写。 | nameregexeq |
!~ | name | text | bool | 不匹配正则表达式,区分大小写。 | nameregexne |
~ | text | text | bool | 匹配正则表达式,区分大小写。 | textregexeq |
!~ | text | text | bool | 不匹配正则表达式,区分大小写。 | textregexne |
|| | text | text | text | 连接。 | textcat |
< | text | text | bool | 小于。 | text_lt |
<= | text | text | bool | 小于或等于。 | text_le |
> | text | text | bool | 大于。 | text_gt |
>= | text | text | bool | 大于或等于。 | text_ge |
~ | bpchar | text | bool | 匹配正则表达式,区分大小写。 | bpcharregexeq |
!~ | bpchar | text | bool | 不匹配正则表达式,区分大小写。 | bpcharregexne |
~~ | name | text | bool | 匹配 LIKE 表达式。 | namelike |
!~~ | name | text | bool | 不匹配 LIKE 表达式。 | namenlike |
~~ | text | text | bool | 匹配 LIKE 表达式。 | textlike |
!~~ | text | text | bool | 不匹配 LIKE 表达式。 | textnlike |
~~ | bpchar | text | bool | 匹配 LIKE 表达式。 | bpcharlike |
!~~ | bpchar | text | bool | 不匹配 LIKE 表达式。 | bpcharnlike |
~* | name | text | bool | 匹配正则表达式,不区分大小写。 | nameicregexeq |
!~* | name | text | bool | 不匹配正则表达式,不区分大小写。 | nameicregexne |
~* | text | text | bool | 匹配正则表达式,不区分大小写。 | texticregexeq |
!~* | text | text | bool | 不匹配正则表达式,不区分大小写。 | texticregexne |
~* | bpchar | text | bool | 匹配正则表达式,不区分大小写。 | bpcharicregexeq |
!~* | bpchar | text | bool | 不匹配正则表达式,不区分大小写。 | bpcharicregexne |
~~* | name | text | bool | 匹配 LIKE 表达式,不区分大小写。 | nameiclike |
!~~* | name | text | bool | 不匹配 LIKE 表达式,不区分大小写。 | nameicnlike |
~~* | text | text | bool | 匹配 LIKE 表达式,不区分大小写。 | texticlike |
!~~* | text | text | bool | 不匹配 LIKE 表达式,不区分大小写。 | texticnlike |
~~* | bpchar | text | bool | 匹配 LIKE 表达式,不区分大小写。 | bpchariclike |
!~~* | bpchar | text | bool | 不匹配 LIKE 表达式,不区分大小写。 | bpcharicnlike |
~<~ | text | text | bool | 小于。 | text_pattern_lt |
~<=~ | text | text | bool | 小于或等于。 | text_pattern_le |
~>=~ | text | text | bool | 大于或等于。 | text_pattern_ge |
~>~ | text | text | bool | 大于。 | text_pattern_gt |
|| | text | anynonarray | text | 连接。 | textanycat |
|| | anynonarray | text | text | 连接。 | anytextcat |
@@ | text | text | bool | 全文搜索匹配。 | ts_match_tt |
@@ | text | tsquery | bool | 全文搜索匹配。 | ts_match_tq |
-> | json | text | json | 获取 JSON 对象字段。 | json_object_field |
->> | json | text | text | 获取 JSON 对象字段并返回文本。 | json_object_field_text |
-> | jsonb | text | jsonb | 获取 jsonb 对象字段。 | jsonb_object_field |
->> | jsonb | text | text | 获取 jsonb 对象字段并返回文本。 | jsonb_object_field_text |
? | jsonb | text | bool | 键存在。 | jsonb_exists |
- | jsonb | text | jsonb | 删除对象字段。 | jsonb_delete(jsonb,text) |
操作符类 11
声明输入类型与此类型相符的操作符类。多态操作符类、类型转换和表达式索引还可能提供其他索引路径;不能仅凭此表判断是否支持索引。
| 操作符类 | 索引方法 | 输入类型 | 操作符族 | 默认 | 存储类型 |
|---|---|---|---|---|---|
text_ops | btree | text | btree/text_ops | 是 | 与输入类型相同 |
text_ops | hash | text | hash/text_ops | 是 | 与输入类型相同 |
varchar_ops | btree | text | btree/text_ops | 否 | 与输入类型相同 |
varchar_ops | hash | text | hash/text_ops | 否 | 与输入类型相同 |
text_pattern_ops | btree | text | btree/text_pattern_ops | 否 | 与输入类型相同 |
varchar_pattern_ops | btree | text | btree/text_pattern_ops | 否 | 与输入类型相同 |
text_pattern_ops | hash | text | hash/text_pattern_ops | 否 | 与输入类型相同 |
varchar_pattern_ops | hash | text | hash/text_pattern_ops | 否 | 与输入类型相同 |
text_ops | spgist | text | spgist/text_ops | 是 | 与输入类型相同 |
text_minmax_ops | brin | text | brin/text_minmax_ops | 是 | text |
text_bloom_ops | brin | text | brin/text_bloom_ops | 否 | text |
版本比较
PostgreSQL 17 → 18。属性比较不包含构建标识和说明正文;原始目录字段与源描述保留原文。
这两个样本的系统目录和结构化属性没有变化。
文档与源码
- 构建
- 18.6 · https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
- 指纹
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f
相关条目
全部数据类型 · 下载此版本 JSON · 最早收录的样本不代表该类型的实际引入版本。