文本搜索调试函数:
|
函数 |
返回类型 |
描述 |
例子 |
结果 |
|
ts_debug([ config
regconfig, ] document text, OUT alias text, OUT description
text, OUT token text, OUT dictionaries regdictionary[], OUT dictionary
regdictionary, OUT lexemes text[]) |
setof record |
测试一个配置 |
ts_debug('english', 'The
Brightest supernovaes') |
(asciiword,"Word, all
ASCII",The,{english_stem},english_stem,{}) ... |
|
ts_lexize(dict
regdictionary, token text) |
text[] |
测试一个字典 |
ts_lexize('english_stem',
'stars') |
{star} |
|
ts_parse(parser_name
text, document text, OUT tokid integer, OUT token text) |
setof record |
测试一个解析器 |
ts_parse('default', 'foo -
bar') |
(1,foo) ... |
|
ts_parse(parser_oid
oid, document text, OUT tokid integer, OUT token text) |
setof record |
测试一个解析器 |
ts_parse(3722, 'foo - bar') |
(1,foo) ... |
|
ts_token_type(parser_name
text, OUT tokid integer, OUT alias text, OUT description
text) |
setof record |
获得解析器定义的记号类型 |
ts_token_type('default') |
(1,asciiword,"Word, all
ASCII") ... |
|
ts_token_type(parser_oid
oid, OUT tokid integer, OUT alias text, OUT description
text) |
setof record |
获得解析器定义的记号类型 |
ts_token_type(3722) |
(1,asciiword,"Word, all
ASCII") ... |
|
ts_stat(sqlquery
text, [ weights text, ] OUT word text, OUT ndoc integer,
OUT nentry integer) |
setof record |
获得一个tsvector列的统计 |
ts_stat('SELECT vector from
apod') |
(foo,10,15) ... |
1.1.1 XML函数
使用XML函数:
|
函数 |
描述 |
语法 |
|
xmlcomment |
创建一个包含使用指定文本内容的XML文件,不包含“--”或“-” |
xmlcomment(text) |
|
xmlconcat |
将由单个XML值组成的列表串成一个单独的值 |
xmlconcat(xml[, ...]) |
|
xmlelement |
使用给定的名称、属性和内容生成一个XML元素 |
xmlelement(name name [, xmlattributes(value
[AS attname] [, ... ])] [, content, ...]) |
|
xmlforest |
使用给定的名称和内容产生一个XML序列 |
xmlforest(content [AS name] [, ...]) |
|
xmlpi |
创建一个XML处理命令 |
xmlpi(name target [, content]) |
|
xmlroot |
用于替换XML根节点的值属性 |
xmlroot(xml, version text | no value [,
standalone yes|no|no value]) |
|
xmlagg |
函数xmlagg是一个聚集函数,将聚集函数调用的输入值串接起来 |
xmlagg(xml) |
1.1.2 JSON 函数和操作符
json和jsonb 操作符:
|
操作符 |
右操作数类型 |
描述 |
例子 |
例子结果 |
|
-> |
int |
获得 JSON 数组元素(索引从 0 开始,负整数结束) |
'[{"a":"foo"},{"b":"bar"},{"c":"baz"}]'::json->2 |
{"c":"baz"} |
|
-> |
text |
通过键获得 JSON 对象域 |
'{"a":
{"b":"foo"}}'::json->'a' |
{"b":"foo"} |
|
->> |
int |
以文本形式获得 JSON 数组元素 |
'[1,2,3]'::json->>2 |
3 |
|
->> |
text |
以文本形式获得 JSON 对象域 |
'{"a":1,"b":2}'::json->>'b' |
2 |
|
#> |
text[] |
获取在指定路径的 JSON 对象 |
'{"a":
{"b":{"c": "foo"}}}'::json#>'{a,b}' |
{"c":
"foo"} |
|
#>> |
text[] |
以文本形式获取在指定路径的 JSON 对象 |
'{"a":[1,2,3],"b":[4,5,6]}'::json#>>'{a,2}' |
3 |
1.1.3 序列操作函数
序列操作函数是用于操作序列对象的函数,序列对象都是用CREATE SEQUENCE创建的特殊的单行表。
|
函数 |
返回类型 |
描述 |
|
currval(regclass) |
bigint |
返回最近一次用nextval获取的指定序列的值 |
|
lastval() |
bigint |
返回最近一次用nextval获取的任何序列的值 |
|
nextval(regclass) |
bigint |
递增序列并返回新值 |
|
setval(regclass, bigint) |
bigint |
设置序列的当前值 |
|
setval(regclass, bigint,
boolean) |
bigint |
设置序列的当前值以及is_called标志 |




