↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 数据类型 / 字符串

text

变长字符串

当前查看 PostgreSQL 18。

中文定义与说明

变长字符串

同版本中文手册定义

text无限长度的变长

查看完整中文手册与上下文。

PG10–20 核心源码清单。类型转换与操作符类列出源码显式声明的关系;缺少记录不能排除通过其他机制进行转换或使用索引。

定义

变长字符串

text
目录名称
pg_catalog.text
类型 OID
25
类型种类
基础类型
声明长度
变长(varlena)
存储策略
扩展
输入函数
textin
输出函数
textout
手册中的声明
文本
手册说明
无限长度的变长

系统目录属性

此构建的源码初始化值。字段含义参见 pg_type 。包含头文件默认值;依赖构建的常量保留符号形式,不作为服务器运行时实测。

oid
25
descr
variable-length string, no limit specified
typacl
_null_
typlen
-1
typelem
0
typname
text
typsend
textsend
typtype
b
typalign
i
typarray
0
typbyval
f
typdelim
','
typinput
textin
typmodin
-
typndims
0
typowner
POSTGRES
typrelid
0
typmodout
-
typoutput
textout
typtypmod
-1
typanalyze
-
typdefault
_null_
typnotnull
f
typreceive
textrecv
typstorage
x
typbasetype
0
typcategory
S
typcollation
default
typisdefined
t
typnamespace
pg_catalog
typsubscript
-
typdefaultbin
_null_
array_type_oid
1009
typispreferred
t
array_type_name
_text

类型转换 18

与此类型相关的显式 pg_cast 记录。PostgreSQL 还支持 pg_cast 之外的类型转换,缺少记录不能证明转换不可能。

源类型目标类型转换上下文转换方式函数
textregclass隐式函数regclass
textbpchar隐式二进制兼容0
textvarchar隐式二进制兼容0
bpchartext隐式函数text(bpchar)
varchartext隐式二进制兼容0
chartext隐式函数text(char)
nametext隐式函数text(name)
textchar赋值函数char(text)
textname隐式函数name(text)
pg_node_treetext隐式二进制兼容0
pg_ndistincttext隐式输入/输出0
pg_dependenciestext隐式输入/输出0
pg_mcv_listtext隐式输入/输出0
cidrtext赋值函数text(inet)
inettext赋值函数text(inet)
booltext赋值函数text(bool)
xmltext赋值二进制兼容0
textxml显式函数xml

运算符重载 58

每种操作数签名均为独立重载。实现函数和返回类型来自同一源码构建。

运算符左操作数右操作数返回类型含义实现函数
=texttextbool等于。texteq
^@texttextbool以指定前缀开头。starts_with
=nametextbool等于。nameeqtext
<nametextbool小于。namelttext
<=nametextbool小于或等于。nameletext
>=nametextbool大于或等于。namegetext
>nametextbool大于。namegttext
<>nametextbool不等于。namenetext
=textnamebool等于。texteqname
<textnamebool小于。textltname
<=textnamebool小于或等于。textlename
>=textnamebool大于或等于。textgename
>textnamebool大于。textgtname
<>textnamebool不等于。textnename
<>texttextbool不等于。textne
~nametextbool匹配正则表达式,区分大小写。nameregexeq
!~nametextbool不匹配正则表达式,区分大小写。nameregexne
~texttextbool匹配正则表达式,区分大小写。textregexeq
!~texttextbool不匹配正则表达式,区分大小写。textregexne
||texttexttext连接。textcat
<texttextbool小于。text_lt
<=texttextbool小于或等于。text_le
>texttextbool大于。text_gt
>=texttextbool大于或等于。text_ge
~bpchartextbool匹配正则表达式,区分大小写。bpcharregexeq
!~bpchartextbool不匹配正则表达式,区分大小写。bpcharregexne
~~nametextbool匹配 LIKE 表达式。namelike
!~~nametextbool不匹配 LIKE 表达式。namenlike
~~texttextbool匹配 LIKE 表达式。textlike
!~~texttextbool不匹配 LIKE 表达式。textnlike
~~bpchartextbool匹配 LIKE 表达式。bpcharlike
!~~bpchartextbool不匹配 LIKE 表达式。bpcharnlike
~*nametextbool匹配正则表达式,不区分大小写。nameicregexeq
!~*nametextbool不匹配正则表达式,不区分大小写。nameicregexne
~*texttextbool匹配正则表达式,不区分大小写。texticregexeq
!~*texttextbool不匹配正则表达式,不区分大小写。texticregexne
~*bpchartextbool匹配正则表达式,不区分大小写。bpcharicregexeq
!~*bpchartextbool不匹配正则表达式,不区分大小写。bpcharicregexne
~~*nametextbool匹配 LIKE 表达式,不区分大小写。nameiclike
!~~*nametextbool不匹配 LIKE 表达式,不区分大小写。nameicnlike
~~*texttextbool匹配 LIKE 表达式,不区分大小写。texticlike
!~~*texttextbool不匹配 LIKE 表达式,不区分大小写。texticnlike
~~*bpchartextbool匹配 LIKE 表达式,不区分大小写。bpchariclike
!~~*bpchartextbool不匹配 LIKE 表达式,不区分大小写。bpcharicnlike
~<~texttextbool小于。text_pattern_lt
~<=~texttextbool小于或等于。text_pattern_le
~>=~texttextbool大于或等于。text_pattern_ge
~>~texttextbool大于。text_pattern_gt
||textanynonarraytext连接。textanycat
||anynonarraytexttext连接。anytextcat
@@texttextbool全文搜索匹配。ts_match_tt
@@texttsquerybool全文搜索匹配。ts_match_tq
->jsontextjson获取 JSON 对象字段。json_object_field
->>jsontexttext获取 JSON 对象字段并返回文本。json_object_field_text
->jsonbtextjsonb获取 jsonb 对象字段。jsonb_object_field
->>jsonbtexttext获取 jsonb 对象字段并返回文本。jsonb_object_field_text
?jsonbtextbool键存在。jsonb_exists
-jsonbtextjsonb删除对象字段。jsonb_delete(jsonb,text)

操作符类 11

声明输入类型与此类型相符的操作符类。多态操作符类、类型转换和表达式索引还可能提供其他索引路径;不能仅凭此表判断是否支持索引。

操作符类索引方法输入类型操作符族默认存储类型
text_opsbtreetextbtree/text_ops是与输入类型相同
text_opshashtexthash/text_ops是与输入类型相同
varchar_opsbtreetextbtree/text_ops否与输入类型相同
varchar_opshashtexthash/text_ops否与输入类型相同
text_pattern_opsbtreetextbtree/text_pattern_ops否与输入类型相同
varchar_pattern_opsbtreetextbtree/text_pattern_ops否与输入类型相同
text_pattern_opshashtexthash/text_pattern_ops否与输入类型相同
varchar_pattern_opshashtexthash/text_pattern_ops否与输入类型相同
text_opsspgisttextspgist/text_ops是与输入类型相同
text_minmax_opsbrintextbrin/text_minmax_ops是text
text_bloom_opsbrintextbrin/text_bloom_ops否text

版本比较

PostgreSQL 17 → 18。属性比较不包含构建标识和说明正文;原始目录字段与源描述保留原文。

这两个样本的系统目录和结构化属性没有变化。

文档与源码

构建
18.6 · https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
指纹
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

相关条目

全部数据类型 · 下载此版本 JSON · 最早收录的样本不代表该类型的实际引入版本。