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

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

百科 / 函数百科

PostgreSQL 函数百科

内置函数是 PostgreSQL 手册第 9 章「函数和操作符」的全部内容:数学、字符串、日期时间、JSON、聚合、窗口、系统信息与管理函数都在其中,每一个都由一条或多条签名描述,写明参数、类型与返回值。本栏目收录 707 个函数,分属 27 个分组,覆盖 PostgreSQL 9.0 至 20,逐版本记下每条签名、说明与示例的变化。9.0 是本数据集的收录基线,不代表这些函数首次于 9.0 引入。

按分组浏览

按版本看变更

版本变动 未收录 存在 新增 签名变化 已移除

函数 签名 主签名 版本变动 最近变更
COMPARISON FUNCTIONS AND OPERATORS 比较函数和操作符 3 个 ↑
error_on_null 1 error_on_null ( anyelement ) → anyelement —
检查输入是否为 null 值;如果是,则生成错误;否则返回输入。 现存
num_nonnulls 1 num_nonnulls ( VARIADIC "any" ) → integer —
返回非 null 参数的数量。 现存
num_nulls 1 num_nulls ( VARIADIC "any" ) → integer —
返回 null 参数的数量。 现存
MATHEMATICAL FUNCTIONS AND OPERATORS 数学函数和操作符 55 个 ↑
abs基线 1 abs ( numeric_type ) → numeric_type —
绝对值 现存
acos基线 1 acos ( double precision ) → double precision —
反余弦,结果为弧度 现存
acosd 1 acosd ( double precision ) → double precision —
反余弦,结果为度数 现存
acosh 1 acosh ( double precision ) → double precision —
反双曲余弦 现存
asin基线 1 asin ( double precision ) → double precision —
反正弦,结果为弧度 现存
asind 1 asind ( double precision ) → double precision —
反正弦,结果为度数 现存
asinh 1 asinh ( double precision ) → double precision —
反双曲正弦 现存
atan基线 1 atan ( double precision ) → double precision —
反正切,结果为弧度 现存
atan2基线 1 atan2 ( y double precision, x double precision ) → double precision —
y/x的反正切,结果为弧度 现存
atan2d 1 atan2d ( y double precision, x double precision ) → double precision —
y/x的反正切,结果为度数 现存
atand 1 atand ( double precision ) → double precision —
反正切,结果为度数 现存
atanh 1 atanh ( double precision ) → double precision —
反双曲正切 现存
cbrt基线 1 cbrt ( double precision ) → double precision —
立方根 现存
ceil基线 2 ceil ( numeric ) → numeric —
大于或等于参数的最接近的整数 现存
ceiling基线 2 ceiling ( numeric ) → numeric —
大于或等于参数的最接近的整数(与 ceil 相同) 现存
cos基线 1 cos ( double precision ) → double precision —
余弦,参数为弧度 现存
cosd 1 cosd ( double precision ) → double precision —
余弦,参数为度数 现存
cosh 1 cosh ( double precision ) → double precision —
双曲余弦 现存
cot基线 1 cot ( double precision ) → double precision —
余切,参数为弧度 现存
cotd 1 cotd ( double precision ) → double precision —
余切,参数为度数 现存
degrees基线 1 degrees ( double precision ) → double precision —
将弧度转换为角度 现存
div基线 1 div ( y numeric, x numeric ) → numeric —
y/x 的整数商(向零截断) 现存
erf 1 erf ( double precision ) → double precision —
误差函数 现存
erfc 1 erfc ( double precision ) → double precision —
互补误差函数(1 - erf(x),对较大输入不会损失精度) 现存
exp基线 2 exp ( numeric ) → numeric —
指数函数(e的给定次幂) 现存
factorial 1 factorial ( bigint ) → numeric —
阶乘 现存
floor基线 2 floor ( numeric ) → numeric —
小于或等于参数的最接近整数 现存
gamma 1 gamma ( double precision ) → double precision —
伽马函数 现存
gcd 1 gcd ( numeric_type, numeric_type ) → numeric_type —
最大公约数(能将两个输入数整除而无余数的最大正数);如果两个输入为零则返回 0;适用于 integer、bigint 和 numeric 现存
lcm 1 lcm ( numeric_type, numeric_type ) → numeric_type —
最小公倍数(同时为两个输入的整数倍的最小严格正数);如果任意一个输入值为零则返回0;适用于integer、bigint 和 numeric 现存
lgamma 1 lgamma ( double precision ) → double precision —
伽马函数绝对值的自然对数 现存
ln基线 2 ln ( numeric ) → numeric —
自然对数 现存
log基线 3 log ( numeric ) → numeric —
以10为底的对数 现存
log10 2 log10 ( numeric ) → numeric —
以10为底的对数(与 log 相同) 现存
min_scale 1 min_scale ( numeric ) → integer —
精确表示给定值所需的最少小数位数 现存
mod基线 1 mod ( y numeric_type, x numeric_type ) → numeric_type —
y/x的余数;适用于smallint、integer、bigint 和 numeric 现存
pi基线 1 pi ( ) → double precision —
π的近似值 现存
power基线 2 power ( a numeric, b numeric ) → numeric —
a的b次幂 现存
radians基线 1 radians ( double precision ) → double precision —
将角度转换为弧度 现存
random基线 7 random ( ) → double precision 192 次
返回范围 0.0 <= x < 1.0 内的随机值 现存
random_normal 1 random_normal ( [mean double precision [, stddev double precision]] ) → double precision —
从具有给定参数的正态分布中返回一个随机值;mean默认为 0.0,stddev默认为 1.0。 现存
round基线 3 round ( numeric ) → numeric —
舍入到最接近的整数。 现存
scale 1 scale ( numeric ) → integer —
参数的小数位数(小数部分的十进制位数) 现存
setseed基线 1 setseed ( double precision ) → void —
为后续的random()和random_normal()调用设置种子;参数必须在-1.0和1.0之间,包括边界值 现存
sign基线 2 sign ( numeric ) → numeric —
参数的符号(-1、0 或 +1) 现存
sin基线 1 sin ( double precision ) → double precision —
正弦,参数为弧度 现存
sind 1 sind ( double precision ) → double precision —
正弦,参数为度数 现存
sinh 1 sinh ( double precision ) → double precision —
双曲正弦 现存
sqrt基线 2 sqrt ( numeric ) → numeric —
平方根 现存
tan基线 1 tan ( double precision ) → double precision —
正切,参数为弧度 现存
tand 1 tand ( double precision ) → double precision —
正切,参数为度数 现存
tanh 1 tanh ( double precision ) → double precision —
双曲正切 现存
trim_scale 1 trim_scale ( numeric ) → numeric —
通过移除尾随零来减少值的小数位数 现存
trunc基线 5 trunc ( numeric ) → numeric 101 次
向零截断为整数 现存
width_bucket基线 3 width_bucket ( operand numeric, low numeric, high numeric, count integer ) → integer 142 次
返回直方图中包含 operand 的桶编号。 现存
STRING FUNCTIONS AND OPERATORS 字符串函数和操作符 58 个 ↑
ascii基线 1 ascii ( text ) → integer —
返回参数的第一个字符的数字代码。 现存
bit_length基线 3 bit_length ( text ) → integer —
返回字符串中的位数(8倍于octet_length)。 现存
btrim基线 2 btrim ( string text [, characters text] ) → text —
从string的开头和结尾移除仅由characters中字符(默认为空格)组成的最长字符串。 现存
casefold 1 casefold ( text ) → text —
根据排序规则对输入字符串执行大小写折叠。 现存
char_length基线 1 char_length ( text ) → integer —
返回字符串中的字符数。 现存
character_length基线 1 character_length ( text ) → integer —
返回字符串中的字符数。 现存
chr基线 1 chr ( integer ) → text —
返回给定代码的字符。 现存
concat 1 concat ( val1 "any" [, val2 "any" [, ...] ] ) → text —
串接所有参数的文本表示。 现存
concat_ws 1 concat_ws ( sep text, val1 "any" [, val2 "any" [, ...] ] ) → text —
用分隔符串接除第一个参数外的所有参数。 现存
format 2 format ( formatstr text [, formatarg "any" [, ...] ] ) → text 9.31 次
根据格式字符串对参数进行格式化;参见第 9.4.1 节。 现存
getdatabaseencoding 1 getdatabaseencoding ( ) → name —
返回当前数据库的编码名称。 现存
initcap基线 1 initcap ( text ) → text —
将每个单词的第一个字母转换为大写(如果该字母是二合字母,且区域设置为ICU或builtin PG_UNICODE_FAST,则转换为标题大小写),其余字母转换为小写。 现存
left 1 left ( string text, n integer ) → text —
返回字符串最左侧的 n 个字符;如果 n 为负,则返回除最后 |n| 个字符之外的全部字符。 现存
length基线 6 length ( text ) → integer 9.11 次
返回字符串中的字符数。 现存
lower基线 3 lower ( text ) → text 142 次
根据数据库的区域设置规则,将字符串转换为全部小写。 现存
lpad基线 1 lpad ( string text, length integer [, fill text] ) → text —
在string前面添加字符fill(默认为空格),将其填充到长度length。 现存
ltrim基线 2 ltrim ( string text [, characters text] ) → text 141 次
从string的开头移除仅由characters中字符(默认为空格)组成的最长字符串。 现存
md5基线 2 md5 ( text ) → text —
计算参数的 MD5 hash,结果以十六进制形式写入。 现存
normalize 1 normalize ( text [, form] ) → text —
将字符串转换为指定的 Unicode 规范化形式。 现存
octet_length基线 4 octet_length ( text ) → integer —
返回字符串的字节数。 现存
overlay基线 3 overlay ( string text PLACING newsubstring text FROM start integer [FOR count integer] ) → text —
用newsubstring替换string中从第start个字符开始、长度为count个字符的子字符串。 现存
parse_ident 1 parse_ident ( qualified_identifier text [, strict_mode boolean DEFAULT true] ) → text[] —
将qualified_identifier拆分为一个标识符数组,去除各个标识符的引号。 现存
pg_client_encoding基线 1 pg_client_encoding ( ) → name —
返回当前客户端编码名称。 现存
position基线 3 position ( substring text IN string text ) → integer —
返回substring在string中首次出现的位置;如果不存在则返回零。 现存
quote_ident基线 1 quote_ident ( text ) → text —
为给定字符串添加适当的引号并返回,使其可用作SQL语句字符串中的标识符。 现存
quote_literal基线 2 quote_literal ( text ) → text —
为给定字符串添加适当的引号并返回,使其可用作SQL语句字符串中的字符串字面量。 现存
quote_nullable基线 2 quote_nullable ( text ) → text —
为给定字符串添加适当的引号并返回,使其可用作SQL语句字符串中的字符串字面量;如果参数为 null,则返回NULL。 现存
regexp_count 2 regexp_count ( string text, pattern text [, start integer [, flags text] ] ) → integer 191 次
返回 POSIX 正则表达式pattern在string中匹配的次数;参见第 9.7.3.1.2 节。 现存
regexp_instr 2 regexp_instr ( string text, pattern text [, start integer [, N integer [, endoption integer [, flags text [, subexpr integer] ] ] ] ] ) → integer 191 次
返回 POSIX 正则表达式pattern在string中第N次匹配的位置;如果没有这样的匹配,则返回零。 现存
regexp_like 2 regexp_like ( string text, pattern text [, flags text] ) → boolean 191 次
检查 POSIX 正则表达式pattern是否在string中出现;参见第 9.7.3.1.4 节。 现存
regexp_match 2 regexp_match ( string text, pattern text [, flags text] ) → text[] 191 次
返回 POSIX 正则表达式pattern与string的第一次匹配中的子字符串;参见第 9.7.3.1.5 节。 现存
regexp_matches基线 2 regexp_matches ( string text, pattern text [, flags text] ) → setof text[] 191 次
返回 POSIX 正则表达式pattern与string的第一次匹配中的子字符串;如果使用g标志,则返回所有匹配中的子字符串。 现存
regexp_replace基线 4 regexp_replace ( string text, pattern text, replacement text [, flags text] ) → text 193 次
替换第一个与 POSIX 正则表达式pattern匹配的子字符串,如果使用了g标志,则替换所有这样的匹配;参见第 9.7.3.1.7 节。 现存
regexp_split_to_array基线 2 regexp_split_to_array ( string text, pattern text [, flags text] ) → text[] 191 次
使用POSIX正则表达式作为分隔符拆分string,生成一个结果的数组;参见第 9.7.3.1.9 节。 现存
regexp_split_to_table基线 2 regexp_split_to_table ( string text, pattern text [, flags text] ) → setof text 191 次
使用POSIX正则表达式作为分隔符拆分string,生成一组结果;参见第 9.7.3.1.8 节。 现存
regexp_substr 2 regexp_substr ( string text, pattern text [, start integer [, N integer [, flags text [, subexpr integer] ] ] ] ) → text 191 次
返回string中 POSIX 正则表达式pattern的第N次匹配对应的子字符串;如果没有这样的匹配,则返回NULL。 现存
repeat基线 1 repeat ( string text, number integer ) → text —
按number指定的次数重复string。 现存
replace基线 1 replace ( string text, from text, to text ) → text —
将string中所有出现的子字符串from替换为子字符串to。 现存
reverse 2 reverse ( text ) → text 181 次
颠倒字符串中字符的顺序。 现存
right 1 right ( string text, n integer ) → text —
返回字符串中的最后n个字符;如果n为负数,则返回除前 |n| 个字符之外的全部字符。 现存
rpad基线 1 rpad ( string text, length integer [, fill text] ) → text —
在string后面追加字符fill(默认为空格),将其填充到长度length。 现存
rtrim基线 2 rtrim ( string text [, characters text] ) → text 141 次
从string的结尾移除仅由characters中字符(默认为空格)组成的最长字符串。 现存
split_part基线 1 split_part ( string text, delimiter text, n integer ) → text —
在出现delimiter时拆分string,并返回第n个字段(从一开始计数);如果n为负数,则返回倒数第 |n| 个字段。 现存
starts_with 1 starts_with ( string text, prefix text ) → boolean —
如果 string 以 prefix开始就返回真。 现存
string_to_array基线 1 string_to_array ( string text, delimiter text [, null_string text] ) → text[] 9.11 次
将string按delimiter分割,并将结果字段形成text数组。 现存
string_to_table 1 string_to_table ( string text, delimiter text [, null_string text] ) → setof text —
在出现delimiter 时拆分string,并将结果字段作为text行的集合返回。 现存
strpos基线 1 strpos ( string text, substring text ) → integer —
返回substring在string中首次出现的位置;如果不存在则返回零。 现存
substr基线 2 substr ( string text, start integer [, count integer] ) → text —
提取string中从第start个字符开始的子字符串;若指定了长度,则提取count个字符。 现存
substring基线 11 substring ( string text [FROM start integer] [FOR count integer] ) → text 193 次
提取string的子字符串:若指定了起始位置,则从第start个字符开始;若指定了长度,则在提取count个字符后停止。 现存
to_ascii基线 3 to_ascii ( string text ) → text —
将string从其他编码转换为ASCII,源编码可以用名称或编号指定。 现存
to_bin 2 to_bin ( integer ) → text —
将数字转换为等价的二进制补码表示。 现存
to_hex基线 2 to_hex ( integer ) → text —
将数字转换为等价的二进制补码的十六进制表示。 现存
to_oct 2 to_oct ( integer ) → text —
将数字转换为等价的二进制补码的八进制表示。 现存
translate基线 1 translate ( string text, from text, to text ) → text —
将string中与from集合中匹配的每个字符替换为to集合中相应的字符。 现存
trim基线 4 trim ( [LEADING | TRAILING | BOTH] [characters text] FROM string text ) → text 142 次
从string的开始、末端或两端(默认为BOTH)移除仅包含characters(默认为空格)字符的最长字符串。 现存
unicode_assigned 1 unicode_assigned ( text ) → boolean —
如果字符串中的所有字符都是已分配的 Unicode 码点,则返回true;否则返回false。 现存
unistr 1 unistr ( text ) → text —
解析参数中转义的 Unicode 字符。 现存
upper基线 3 upper ( text ) → text 142 次
根据数据库的区域设置规则,将字符串转换为全部大写。 现存
BINARY STRING FUNCTIONS AND OPERATORS 二进制串函数和操作符 16 个 ↑
bit_count 2 bit_count ( bytes bytea ) → bigint —
返回二进制字符串中被置位的位数(也称为“popcount”)。 现存
convert基线 1 convert ( bytes bytea, src_encoding name, dest_encoding name ) → bytea —
将表示编码src_encoding的文本的二进制字符串转换为编码dest_encoding的二进制字符串(适用的转换请参阅第 23.3.4 节)。 现存
convert_from基线 1 convert_from ( bytes bytea, src_encoding name ) → text —
将表示编码src_encoding的文本的二进制字符串转换为数据库编码中的text。 现存
convert_to基线 1 convert_to ( string text, dest_encoding name ) → bytea —
将text字符串(数据库编码)转换为编码dest_encoding中编码的二进制字符串。 现存
crc32 1 crc32 ( bytea ) → bigint —
计算二进制字符串的 CRC-32 值。 现存
crc32c 1 crc32c ( bytea ) → bigint —
计算二进制字符串的 CRC-32C 值。 现存
decode基线 1 decode ( string text, format text ) → bytea —
从文本表示中解码二进制数据;支持的format值与encode相同。 现存
encode基线 1 encode ( bytes bytea, format text ) → text —
将二进制数据编码成文本表示;支持的format值为:base32hex, base64, base64url, escape, hex。 现存
get_bit基线 2 get_bit ( bytes bytea, n bigint ) → integer —
从二进制字符串中提取编号为 n 的位。 现存
get_byte基线 1 get_byte ( bytes bytea, n integer ) → integer —
从二进制字符串中提取编号为 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。 现存
DATA TYPE FORMATTING FUNCTIONS 数据类型格式化函数 4 个 ↑
to_char基线 4 to_char ( timestamp, text ) → text —
根据给定的格式将时间戳转换为字符串。 现存
to_date基线 1 to_date ( text, text ) → date —
根据给定的格式将字符串转换为日期。 现存
to_number基线 1 to_number ( text, text ) → numeric —
根据给定的格式将字符串转换为数值。 现存
to_timestamp基线 2 to_timestamp ( text, text ) → timestamp with time zone —
根据给定的格式将字符串转换为时间戳。 现存
DATE/TIME FUNCTIONS AND OPERATORS 日期/时间函数和操作符 29 个 ↑
age基线 3 age ( timestamp, timestamp ) → interval —
将两个参数相减,生成一个使用年和月而不是只用日的“符号化”结果 现存
clock_timestamp基线 2 clock_timestamp ( ) → timestamp with time zone —
当前日期和时间(在语句执行期间变化);参见第 9.9.5 节 现存
current_date基线 1 current_date → date —
当前日期;参见第 9.9.5 节 现存
current_time基线 3 current_time → time with time zone —
一天中的当前时刻;参见第 9.9.5 节 现存
current_timestamp基线 3 current_timestamp → timestamp with time zone —
当前日期和时间(当前事务开始时);参见第 9.9.5 节 现存
date_add 1 date_add ( timestamp with time zone, interval [, text] ) → timestamp with time zone —
将一个 interval 加到 timestamp with time zone 上,并根据第三个参数命名的时区,或在省略该参数时根据当前TimeZone设置,计算时刻和夏令时调整。 现存
date_bin 2 date_bin ( interval, timestamp, timestamp ) → timestamp —
将输入按指定的间隔进行分箱(bin),对齐到指定的原点;参见第 9.9.3 节 现存
date_part基线 3 date_part ( text, timestamp ) → double precision —
获取时间戳子字段(等同于 extract);参见第 9.9.1 节 现存
date_subtract 1 date_subtract ( timestamp with time zone, interval [, text] ) → timestamp with time zone —
从一个 timestamp with time zone 中减去 interval,并根据第三个参数命名的时区,或在省略该参数时根据当前TimeZone设置,计算时刻和夏令时调整。 现存
date_trunc基线 4 date_trunc ( text, timestamp ) → timestamp 122 次
截断到指定的精度;参见第 9.9.2 节 现存
extract基线 3 extract ( field FROM timestamp ) → numeric 192 次
获取时间戳子字段;参见第 9.9.1 节 现存
isfinite基线 3 isfinite ( date ) → boolean —
测试日期是否有限(不是正负无穷) 现存
justify_days基线 1 justify_days ( interval ) → interval —
调整间隔,将30天的时间段转换为月份 现存
justify_hours基线 1 justify_hours ( interval ) → interval —
调整间隔,将24小时时间段转换为天数 现存
justify_interval基线 1 justify_interval ( interval ) → interval —
使用 justify_days 和 justify_hours调整时间间隔,并额外调整符号 现存
localtime基线 3 localtime → time —
一天中的当前时刻;参见第 9.9.5 节 现存
localtimestamp基线 3 localtimestamp → timestamp —
当前日期和时间(当前事务开始时);参见第 9.9.5 节 现存
make_date 1 make_date ( year int, month int, day int ) → date —
从年、月和日字段创建日期(负数年份表示BC) 现存
make_interval 1 make_interval ( [years int [, months int [, weeks int [, days int [, hours int [, mins int [, secs double precision]]]]]]] ) → interval —
从年、月、周、日、小时、分钟和秒字段创建时间间隔,每个字段默认为0 现存
make_time 1 make_time ( hour int, min int, sec double precision ) → time —
从小时、分钟和秒字段创建时间 现存
make_timestamp 1 make_timestamp ( year int, month int, day int, hour int, min int, sec double precision ) → timestamp —
从年、月、日、小时、分钟和秒字段创建时间戳(负数年份表示BC) 现存
make_timestamptz 1 make_timestamptz ( year int, month int, day int, hour int, min int, sec double precision [, timezone text] ) → timestamp with time zone —
从年、月、日、小时、分钟和秒字段并结合时区创建时间戳(负数年份表示 BC)。 现存
now基线 2 now ( ) → timestamp with time zone —
当前日期和时间(当前事务开始时);参见第 9.9.5 节 现存
pg_sleep基线 1 pg_sleep ( double precision ) —
pg_sleep使当前会话的进程休眠,直到经过指定的秒数。 现存
pg_sleep_for 1 pg_sleep_for ( interval ) —
pg_sleep使当前会话的进程休眠,直到经过指定的秒数。 现存
pg_sleep_until 1 pg_sleep_until ( timestamp with time zone ) —
pg_sleep使当前会话的进程休眠,直到经过指定的秒数。 现存
statement_timestamp基线 2 statement_timestamp ( ) → timestamp with time zone —
当前日期和时间(当前语句开始时);参见第 9.9.5 节 现存
timeofday基线 2 timeofday ( ) → text —
当前的日期和时间(类似 clock_timestamp,但是采用 text 字符串);参见第 9.9.5 节 现存
transaction_timestamp基线 2 transaction_timestamp ( ) → timestamp with time zone —
当前日期和时间(当前事务开始时);参见第 9.9.5 节 现存
ENUM SUPPORT FUNCTIONS 枚举支持函数 3 个 ↑
enum_first基线 1 enum_first ( anyenum ) → anyenum —
返回输入枚举类型的第一个值。 现存
enum_last基线 1 enum_last ( anyenum ) → anyenum —
返回输入枚举类型的最后一个值。 现存
enum_range基线 2 enum_range ( anyenum ) → anyarray —
将输入枚举类型的所有值作为一个有序的数组返回。 现存
GEOMETRIC FUNCTIONS AND OPERATORS 几何函数和操作符 21 个 ↑
area基线 1 area ( geometric_type ) → double precision —
计算面积。 现存
bound_box 1 bound_box ( box, box ) → box —
计算两个矩形框的边界框。 现存
box基线 4 box ( circle ) → box 9.51 次
计算内接于圆的矩形框。 现存
center基线 1 center ( geometric_type ) → point —
计算中心点。 现存
circle基线 3 circle ( box ) → circle —
计算包围矩形框的最小圆。 现存
diagonal 1 diagonal ( box ) → lseg —
提取框的对角线作为线段(与 lseg(box)相同)。 现存
diameter基线 1 diameter ( circle ) → double precision —
计算圆的直径。 现存
height基线 1 height ( box ) → double precision —
计算框的垂直尺寸。 现存
isclosed基线 1 isclosed ( path ) → boolean —
路径是否封闭? 现存
isopen基线 1 isopen ( path ) → boolean —
路径是否开放? 现存
line 1 line ( point, point ) → line —
将两个点转换成通过它们的直线。 现存
lseg基线 2 lseg ( box ) → lseg —
提取框的对角线作为线段。 现存
npoints基线 1 npoints ( geometric_type ) → integer —
返回点的数量。 现存
path基线 1 path ( polygon ) → path —
将多边形转换为具有相同点列表的封闭路径。 现存
pclose基线 1 pclose ( path ) → path —
将路径转换为封闭形式。 现存
point基线 5 point ( double precision, double precision ) → point —
从它的坐标构造点。 现存
polygon基线 4 polygon ( box ) → polygon —
将框转换为4点多边形。 现存
popen基线 1 popen ( path ) → path —
将路径转换为开放形式。 现存
radius基线 1 radius ( circle ) → double precision —
计算圆的半径。 现存
slope 1 slope ( point, point ) → double precision —
计算通过两点所画直线的斜率。 现存
width基线 1 width ( box ) → double precision —
计算框的水平大小。 现存
NETWORK ADDRESS FUNCTIONS AND OPERATORS 网络地址函数和操作符 13 个 ↑
abbrev基线 2 abbrev ( inet ) → text —
创建文本形式的缩写显示格式。 现存
broadcast基线 1 broadcast ( inet ) → inet —
为地址的网络计算广播地址。 现存
family基线 1 family ( inet ) → integer —
返回地址的地址族:4 对应 IPv4,6 对应 IPv6。 现存
host基线 1 host ( inet ) → text —
返回IP地址文本,忽略子网掩码。 现存
hostmask基线 1 hostmask ( inet ) → inet —
为地址的网络计算主机掩码。 现存
inet_merge 1 inet_merge ( inet, inet ) → cidr —
计算包含两个给定网络的最小网络。 现存
inet_same_family 1 inet_same_family ( inet, inet ) → boolean —
测试地址是否属于同一IP族。 现存
macaddr8_set7bit 1 macaddr8_set7bit ( macaddr8 ) → macaddr8 —
将地址的第 7 位设置为 1,生成所谓的修订 EUI-64 格式,以便用于 IPv6 地址。 现存
masklen基线 1 masklen ( inet ) → integer —
返回子网掩码长度,以位为单位。 现存
netmask基线 1 netmask ( inet ) → inet —
为地址的网络计算网络掩码。 现存
network基线 1 network ( inet ) → cidr —
返回地址的网络部分,将子网掩码右边的部分归零。 现存
set_masklen基线 2 set_masklen ( inet, integer ) → inet —
设置inet值的子网掩码长度。 现存
text基线 1 text ( inet ) → text —
以文本形式返回未缩写的IP地址和子网掩码长度。 现存
TEXT SEARCH FUNCTIONS AND OPERATORS 文本检索函数和操作符 27 个 ↑
array_to_tsvector 1 array_to_tsvector ( text[] ) → tsvector —
将文本字符串数组转换为tsvector。 现存
get_current_ts_config基线 1 get_current_ts_config ( ) → regconfig —
返回当前默认文本检索配置的 OID(由default_text_search_config设置)。 现存
json_to_tsvector 1 json_to_tsvector ( [config regconfig, ] document json, filter jsonb ) → tsvector —
选择filter请求的JSON文档中的每个项,并将每个项转换为tsvector,根据指定的或默认配置对单词进行正规化。 现存
jsonb_to_tsvector 1 jsonb_to_tsvector ( [config regconfig, ] document jsonb, filter jsonb ) → tsvector —
选择filter请求的JSON文档中的每个项,并将每个项转换为tsvector,根据指定的或默认配置对单词进行正规化。 现存
numnode基线 1 numnode ( tsquery ) → integer —
返回tsquery中词位和操作符的数目。 现存
phraseto_tsquery 1 phraseto_tsquery ( [config regconfig, ] query text ) → tsquery —
将文本转换为tsquery,根据指定的或默认配置对单词进行正规化。 现存
plainto_tsquery基线 1 plainto_tsquery ( [config regconfig, ] query text ) → tsquery —
将文本转换为tsquery,根据指定的或默认配置对单词进行正规化。 现存
querytree基线 1 querytree ( tsquery ) → text —
生成tsquery中可索引部分的表示。 现存
setweight基线 2 setweight ( vector tsvector, weight "char" ) → tsvector 9.61 次
将指定的weight赋给vector的每个元素。 现存
strip基线 1 strip ( tsvector ) → tsvector —
从tsvector中移除位置和权重。 现存
to_tsquery基线 1 to_tsquery ( [config regconfig, ] query text ) → tsquery —
将文本转换为tsquery,根据指定的或默认配置对单词进行正规化。 现存
to_tsvector基线 3 to_tsvector ( [config regconfig, ] document text ) → tsvector 101 次
将文本转换为tsvector,根据指定的或默认配置对单词进行正规化。 现存
ts_debug基线 1 ts_debug ( [config regconfig, ] document text ) → setof record ( alias text, description text, token text, dictionaries regdictionary[], dictionary regdictionary, lexemes text[] ) —
根据指定的或默认的文本检索配置从document中提取和正规化词元,并返回关于每个词元是如何处理的信息。 现存
ts_delete 2 ts_delete ( vector tsvector, lexeme text ) → tsvector —
从vector中删除给定的lexeme的所有出现。 现存
ts_filter 1 ts_filter ( vector tsvector, weights "char"[] ) → tsvector —
只从vector中选择具有给定weights的元素。 现存
ts_headline基线 3 ts_headline ( [config regconfig, ] document text, query tsquery [, options text] ) → text 101 次
以缩略形式显示query在document中的匹配项;后者必须是原始文本,不能是tsvector。 现存
ts_lexize基线 1 ts_lexize ( dict regdictionary, token text ) → text[] —
如果词典识别输入词元,则返回由替换词位组成的数组;如果词典识别该词元,但它是停用词,则返回空数组;如果词典无法识别该词元,则返回NULL。 现存
ts_parse基线 2 ts_parse ( parser_name text, document text ) → setof record ( tokid integer, token text ) —
使用指定名称的解析器从document中提取词元。 现存
ts_rank基线 1 ts_rank ( [weights real[], ] vector tsvector, query tsquery [, normalization integer] ) → real —
计算一个分数,显示vector与query的匹配程度。 现存
ts_rank_cd基线 1 ts_rank_cd ( [weights real[], ] vector tsvector, query tsquery [, normalization integer] ) → real —
使用覆盖密度算法计算一个分数,显示vector与query的匹配程度。 现存
ts_rewrite基线 2 ts_rewrite ( query tsquery, target tsquery, substitute tsquery ) → tsquery —
在query中使用 substitute替换出现的target。 现存
ts_stat基线 1 ts_stat ( sqlquery text [, weights text] ) → setof record ( word text, ndoc integer, nentry integer ) —
执行sqlquery,该查询必须返回单个tsvector列,并返回数据中每个不同词位的统计信息。 现存
ts_token_type基线 2 ts_token_type ( parser_name text ) → setof record ( tokid integer, alias text, description text ) —
返回一个表,该表描述指定名称的解析器可以识别的每种类型的词元。 现存
tsquery_phrase 2 tsquery_phrase ( query1 tsquery, query2 tsquery ) → tsquery —
构造一个短语查询,在连续的词位上搜索query1和query2的匹配项(与<->操作符相同)。 现存
tsvector_to_array 1 tsvector_to_array ( tsvector ) → text[] —
将tsvector转换为词位的数组。 现存
unnest基线 4 unnest ( tsvector ) → setof record ( lexeme text, positions smallint[], weights text ) 143 次
将tsvector展开为一组行,每行对应一个词位。 现存
websearch_to_tsquery 1 websearch_to_tsquery ( [config regconfig, ] query text ) → tsquery —
将文本转换为tsquery,根据指定的或默认配置对单词进行正规化。 现存
TID FUNCTIONS TID 函数 2 个 ↑
tid_block 1 tid_block ( tid ) → bigint —
从元组标识符中提取块号。 现存
tid_offset 1 tid_offset ( tid ) → integer —
从元组标识符中提取块内的元组偏移量。 现存
UUID FUNCTIONS UUID 函数 5 个 ↑
gen_random_uuid 1 gen_random_uuid ( ) → uuid 181 次
生成一个版本 4(随机)的 UUID 现存
uuid_extract_timestamp 1 uuid_extract_timestamp ( uuid ) → timestamp with time zone 181 次
从版本 1、6 或 7 的 UUID 中提取 timestamp with time zone。 现存
uuid_extract_version 1 uuid_extract_version ( uuid ) → smallint 181 次
从符合 RFC 9562 所描述某一变体的 UUID 中提取版本号。 现存
uuidv4 1 uuidv4 ( ) → uuid —
生成一个版本 4(随机)的 UUID 现存
uuidv7 1 uuidv7 ( [shift interval] ) → uuid —
生成一个版本 7(按时间排序)的 UUID。 现存
XML FUNCTIONS XML 函数 29 个 ↑
cursor_to_xml基线 1 cursor_to_xml ( cursor refcursor, count integer, nulls boolean, tableforest boolean, targetns text ) → xml —
table_to_xml映射由参数table传递的命名表的内容。 现存
cursor_to_xmlschema基线 1 cursor_to_xmlschema ( cursor refcursor, nulls boolean, tableforest boolean, targetns text ) → xml —
必须传入相同的参数,才能得到彼此匹配的 XML 数据映射和 XML 模式文档。 现存
database_to_xml基线 1 database_to_xml ( nulls boolean, tableforest boolean, targetns text ) → xml —
这些函数会忽略当前用户不可读的表。 现存
database_to_xml_and_xmlschema基线 1 database_to_xml_and_xmlschema ( nulls boolean, tableforest boolean, targetns text ) → xml —
这些函数会忽略当前用户不可读的表。 现存
database_to_xmlschema基线 1 database_to_xmlschema ( nulls boolean, tableforest boolean, targetns text ) → xml —
这些函数会忽略当前用户不可读的表。 现存
query_to_xml基线 1 query_to_xml ( query text, nulls boolean, tableforest boolean, targetns text ) → xml —
table_to_xml映射由参数table传递的命名表的内容。 现存
query_to_xml_and_xmlschema基线 1 query_to_xml_and_xmlschema ( query text, nulls boolean, tableforest boolean, targetns text ) → xml —
下面的函数产生 XML 数据映射和对应的 XML 模式,并把产生的结果链接在一起放在一个文档(或森林)中。 现存
query_to_xmlschema基线 1 query_to_xmlschema ( query text, nulls boolean, tableforest boolean, targetns text ) → xml —
必须传入相同的参数,才能得到彼此匹配的 XML 数据映射和 XML 模式文档。 现存
schema_to_xml基线 1 schema_to_xml ( schema name, nulls boolean, tableforest boolean, targetns text ) → xml —
这些函数会忽略当前用户不可读的表。 现存
schema_to_xml_and_xmlschema基线 1 schema_to_xml_and_xmlschema ( schema name, nulls boolean, tableforest boolean, targetns text ) → xml —
这些函数会忽略当前用户不可读的表。 现存
schema_to_xmlschema基线 1 schema_to_xmlschema ( schema name, nulls boolean, tableforest boolean, targetns text ) → xml —
这些函数会忽略当前用户不可读的表。 现存
table_to_xml基线 1 table_to_xml ( table regclass, nulls boolean, tableforest boolean, targetns text ) → xml —
table_to_xml映射由参数table传递的命名表的内容。 现存
table_to_xml_and_xmlschema基线 1 table_to_xml_and_xmlschema ( table regclass, nulls boolean, tableforest boolean, targetns text ) → xml —
下面的函数产生 XML 数据映射和对应的 XML 模式,并把产生的结果链接在一起放在一个文档(或森林)中。 现存
table_to_xmlschema基线 1 table_to_xmlschema ( table regclass, nulls boolean, tableforest boolean, targetns text ) → xml —
必须传入相同的参数,才能得到彼此匹配的 XML 数据映射和 XML 模式文档。 现存
xml_is_well_formed 1 xml_is_well_formed ( text ) → boolean —
这些函数检查一个text串是不是一个良构的 XML,返回一个布尔结果。 现存
xml_is_well_formed_content 1 xml_is_well_formed_content ( text ) → boolean —
这些函数检查一个text串是不是一个良构的 XML,返回一个布尔结果。 现存
xml_is_well_formed_document 1 xml_is_well_formed_document ( text ) → boolean —
这些函数检查一个text串是不是一个良构的 XML,返回一个布尔结果。 现存
xmlagg基线 2 xmlagg ( xml ) → xml 171 次
和这里描述的其他函数不同,函数xmlagg是一个聚合函数。 现存
xmlcomment基线 1 xmlcomment ( text ) → xml —
函数xmlcomment创建了一个 XML 值,它包含一个使用指定文本作为内容的 XML 注释。 现存
xmlconcat基线 1 xmlconcat ( xml [, ...] ) → xml —
函数xmlconcat将由各个独立 XML 值组成的列表串接成一个单独的值,这个值包含一个 XML 内容片段。 现存
xmlelement基线 1 xmlelement ( NAME name [, XMLATTRIBUTES ( attvalue [AS attname] [, ...] ) ] [, content [, ...]] ) → xml —
表达式xmlelement使用给定名称、属性和内容产生一个 XML 元素。 现存
XMLEXISTS 1 XMLEXISTS ( text PASSING [BY {REF|VALUE}] xml [BY {REF|VALUE}] ) → boolean 121 次
函数xmlexists对一个 XPath 1.0 表达式(第一个参数)求值,以传递的XML值作为其上下文项。 现存
xmlforest基线 1 xmlforest ( content [AS name] [, ...] ) → xml —
表达式xmlforest使用给定名称和内容产生由元素构成的 XML 森林(序列)。 现存
xmlpi基线 1 xmlpi ( NAME name [, content] ) → xml —
表达式xmlpi创建一个 XML 处理指令。 现存
xmlroot基线 1 xmlroot ( xml, VERSION {text|NO VALUE} [, STANDALONE {YES|NO|NO VALUE} ] ) → xml —
表达式xmlroot修改一个 XML 值的根节点的属性。 现存
XMLTABLE 1 XMLTABLE ( [XMLNAMESPACES ( namespace_uri AS namespace_name [, ...] ), ] row_expression PASSING [BY {REF|VALUE}] document_expression [BY {REF|VALUE}] COLUMNS name { type [PATH column_expression] [DEFAULT default_expression] [NOT NULL | NULL] | FOR ORDINALITY } [, ...] ) → setof record 121 次
xmltable表达式根据给定的 XML 值、用于提取行的 XPath 过滤器和一组列定义生成一个表。 现存
xmltext 1 xmltext ( text ) → xml —
函数 xmltext 返回一个只包含单个文本节点的 XML 值,该文本节点的内容就是输入参数。 现存
xpath基线 1 xpath ( xpath text, xml xml [, nsarray text[]] ) → xml[] 9.11 次
函数xpath根据 XML 值xml计算 XPath 1.0 表达式xpath(以文本形式给出)。 现存
xpath_exists 1 xpath_exists ( xpath text, xml xml [, nsarray text[]] ) → boolean —
函数xpath_exists是xpath函数的一种特殊形式。 现存
JSON FUNCTIONS AND OPERATORS JSON 函数和操作符 61 个 ↑
array_to_json 1 array_to_json ( anyarray [, boolean] ) → json 9.42 次
将SQL数组转换为JSON数组。 现存
json 1 json ( expression [FORMAT JSON [ENCODING UTF8]] [ { WITH | WITHOUT } UNIQUE [KEYS]] ) → json —
将给定的text或bytea字符串表达式(采用 UTF8 编码)转换为 JSON 值。 现存
json_array 2 json_array ( [ { value_expression [FORMAT JSON] } [, ...] ] [ { NULL | ABSENT } ON NULL] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ]) —
从一系列value_expression参数或query_expression的结果构造 JSON 数组;后者必须是返回单列的 SELECT 查询。 现存
json_array_elements 1 json_array_elements ( json ) → setof json 9.41 次
将顶级JSON数组展开为一组JSON值。 现存
json_array_elements_text 1 json_array_elements_text ( json ) → setof text —
将顶级 JSON 数组展开为一组text值。 现存
json_array_length 1 json_array_length ( json ) → integer —
返回顶级JSON数组中的元素数量。 现存
json_build_array 1 json_build_array ( VARIADIC "any" ) → json —
根据可变参数列表构建可能异构类型的JSON数组。 现存
json_build_object 1 json_build_object ( VARIADIC "any" ) → json —
根据可变参数列表构建一个JSON对象。 现存
json_each 1 json_each ( json ) → setof record ( key text, value json ) 9.41 次
将顶级JSON对象展开为一组键/值对。 现存
json_each_text 1 json_each_text ( json ) → setof record ( key text, value text ) 9.41 次
将顶级 JSON 对象展开为一组键/值对。 现存
JSON_EXISTS 1 JSON_EXISTS ( context_item, path_expression [PASSING { value AS varname } [, ...]] [{ TRUE | FALSE | UNKNOWN | ERROR } ON ERROR]) → boolean —
如果将 SQL/JSON path_expression 应用于 context_item 后产生了任何项,则返回 true,否则返回 false。 现存
json_extract_path 1 json_extract_path ( from_json json, VARIADIC path_elems text[] ) → json 9.41 次
在指定路径下提取JSON子对象。 现存
json_extract_path_text 1 json_extract_path_text ( from_json json, VARIADIC path_elems text[] ) → text —
将指定路径上的 JSON 子对象提取为text。 现存
json_object 3 json_object ( [ { key_expression { VALUE | ':' } value_expression [FORMAT JSON [ENCODING UTF8] ] }[, ...] ] [ { NULL | ABSENT } ON NULL] [ { WITH | WITHOUT } UNIQUE [KEYS] ] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ]) 161 次
根据给定的所有键值对构造 JSON 对象;如果没有给出键值对,则构造空对象。 现存
json_object_keys 1 json_object_keys ( json ) → setof text 9.41 次
返回顶级JSON对象中的键集合。 现存
json_populate_record 1 json_populate_record ( base anyelement, from_json json ) → anyelement 9.41 次
将顶级 JSON 对象展开为一行,其复合类型与base参数相同。 现存
json_populate_recordset 1 json_populate_recordset ( base anyelement, from_json json ) → setof anyelement 9.41 次
将由对象组成的顶级 JSON 数组展开为一组行,其复合类型与base参数相同。 现存
JSON_QUERY 1 JSON_QUERY ( context_item, path_expression [PASSING { value AS varname } [, ...]] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ] [ { WITHOUT | WITH { CONDITIONAL | [UNCONDITIONAL] } } [ARRAY] WRAPPER] [ { KEEP | OMIT } QUOTES [ON SCALAR STRING] ] [ { ERROR | NULL | EMPTY { [ARRAY] | OBJECT } | DEFAULT expression } ON EMPTY] [ { ERROR | NULL | EMPTY { [ARRAY] | OBJECT } | DEFAULT expression } ON ERROR]) → jsonb —
返回将 SQL/JSON path_expression 应用于 context_item 的结果。 现存
json_scalar 1 json_scalar ( expression ) —
将给定的 SQL 标量值转换为 JSON 标量值。 现存
json_serialize 1 json_serialize ( expression [FORMAT JSON [ENCODING UTF8] ] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ] ) —
将 SQL/JSON 表达式转换为字符或二进制字符串。 现存
json_strip_nulls 1 json_strip_nulls ( target json [,strip_in_arrays boolean] ) → json 181 次
递归地删除给定 JSON 值中所有值为 null 的对象字段。 现存
JSON_TABLE 1 JSON_TABLE ( context_item, path_expression [ AS json_path_name] [ PASSING { value AS varname } [, ...] ] COLUMNS ( json_table_column [, ...] ) [ PLAN ( json_table_plan ) | PLAN DEFAULT ( { OUTER | INNER } [ , { CROSS | UNION } ] | { CROSS | UNION } [ , { OUTER | INNER } ] ) ] [ { ERROR | EMPTY [ARRAY]} ON ERROR] ) 201 次
下面更详细地说明每个语法元素。 现存
json_to_record 1 json_to_record ( json ) → record —
将顶级JSON对象展开为具有由 AS子句定义的复合类型的行。 现存
json_to_recordset 1 json_to_recordset ( json ) → setof record —
将顶级JSON对象数组展开为一组由AS子句定义的复合类型的行。 现存
json_typeof 1 json_typeof ( json ) → text —
以文本字符串形式返回顶级JSON值的类型。 现存
JSON_VALUE 1 JSON_VALUE ( context_item, path_expression [PASSING { value AS varname } [, ...]] [RETURNING data_type] [ { ERROR | NULL | DEFAULT expression } ON EMPTY] [ { ERROR | NULL | DEFAULT expression } ON ERROR]) → text —
返回将 SQL/JSON path_expression 应用于 context_item 的结果。 现存
jsonb_array_elements 1 jsonb_array_elements ( jsonb ) → setof jsonb —
将顶级JSON数组展开为一组JSON值。 现存
jsonb_array_elements_text 1 jsonb_array_elements_text ( jsonb ) → setof text —
将顶级 JSON 数组展开为一组text值。 现存
jsonb_array_length 1 jsonb_array_length ( jsonb ) → integer —
返回顶级JSON数组中的元素数量。 现存
jsonb_build_array 1 jsonb_build_array ( VARIADIC "any" ) → jsonb —
根据可变参数列表构建可能异构类型的JSON数组。 现存
jsonb_build_object 1 jsonb_build_object ( VARIADIC "any" ) → jsonb —
根据可变参数列表构建一个JSON对象。 现存
jsonb_each 1 jsonb_each ( jsonb ) → setof record ( key text, value jsonb ) —
将顶级JSON对象展开为一组键/值对。 现存
jsonb_each_text 1 jsonb_each_text ( jsonb ) → setof record ( key text, value text ) —
将顶级 JSON 对象展开为一组键/值对。 现存
jsonb_extract_path 1 jsonb_extract_path ( from_json jsonb, VARIADIC path_elems text[] ) → jsonb —
在指定路径下提取JSON子对象。 现存
jsonb_extract_path_text 1 jsonb_extract_path_text ( from_json jsonb, VARIADIC path_elems text[] ) → text —
将指定路径上的 JSON 子对象提取为text。 现存
jsonb_insert 1 jsonb_insert ( target jsonb, path text[], new_value jsonb [, insert_after boolean] ) → jsonb —
返回插入new_value的target。 现存
jsonb_object 2 jsonb_object ( text[] ) → jsonb —
从 text 数组构造 JSON 对象。 现存
jsonb_object_keys 1 jsonb_object_keys ( jsonb ) → setof text —
返回顶级JSON对象中的键集合。 现存
jsonb_path_exists 1 jsonb_path_exists ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → boolean —
检查 JSON 路径是否为指定的 JSON 值返回任何项。 现存
jsonb_path_exists_tz 1 jsonb_path_exists_tz ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → boolean —
这些函数的作用类似于上面描述的没有_tz后缀的对应函数,不同之处在于这些函数支持需要时区感知转换的日期/时间值的比较。 现存
jsonb_path_match 1 jsonb_path_match ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → boolean —
返回指定 JSON 值的 JSON 路径谓词检查的 SQL 布尔结果。 现存
jsonb_path_match_tz 1 jsonb_path_match_tz ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → boolean —
这些函数的作用类似于上面描述的没有_tz后缀的对应函数,不同之处在于这些函数支持需要时区感知转换的日期/时间值的比较。 现存
jsonb_path_query 1 jsonb_path_query ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → setof jsonb —
为指定的 JSON 值返回由 JSON 路径返回的所有 JSON 项。 现存
jsonb_path_query_array 1 jsonb_path_query_array ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → jsonb —
以JSON数组的形式返回由JSON路径为指定的JSON值返回的所有JSON项。 现存
jsonb_path_query_array_tz 1 jsonb_path_query_array_tz ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → jsonb —
这些函数的作用类似于上面描述的没有_tz后缀的对应函数,不同之处在于这些函数支持需要时区感知转换的日期/时间值的比较。 现存
jsonb_path_query_first 1 jsonb_path_query_first ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → jsonb —
为指定的JSON值返回由JSON路径返回的第一个JSON项。 现存
jsonb_path_query_first_tz 1 jsonb_path_query_first_tz ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → jsonb —
这些函数的作用类似于上面描述的没有_tz后缀的对应函数,不同之处在于这些函数支持需要时区感知转换的日期/时间值的比较。 现存
jsonb_path_query_tz 1 jsonb_path_query_tz ( target jsonb, path jsonpath [, vars jsonb [, silent boolean]] ) → setof jsonb —
这些函数的作用类似于上面描述的没有_tz后缀的对应函数,不同之处在于这些函数支持需要时区感知转换的日期/时间值的比较。 现存
jsonb_populate_record 1 jsonb_populate_record ( base anyelement, from_json jsonb ) → anyelement —
将顶级 JSON 对象展开为一行,其复合类型与base参数相同。 现存
jsonb_populate_record_valid 1 jsonb_populate_record_valid ( base anyelement, from_json json ) → boolean —
用于测试jsonb_populate_record的函数。 现存
jsonb_populate_recordset 1 jsonb_populate_recordset ( base anyelement, from_json jsonb ) → setof anyelement —
将由对象组成的顶级 JSON 数组展开为一组行,其复合类型与base参数相同。 现存
jsonb_pretty 1 jsonb_pretty ( jsonb ) → text —
将给定的 JSON 值转换为经过美化并带有缩进的文本。 现存
jsonb_set 1 jsonb_set ( target jsonb, path text[], new_value jsonb [, create_if_missing boolean] ) → jsonb —
返回target,将path指定的项替换为new_value,如果create_if_missing为真(此为默认值)并且path指定的项不存在,则添加new_value。 现存
jsonb_set_lax 1 jsonb_set_lax ( target jsonb, path text[], new_value jsonb [, create_if_missing boolean [, null_value_treatment text]] ) → jsonb —
如果new_value不是NULL,则行为与jsonb_set完全相同。 现存
jsonb_strip_nulls 1 jsonb_strip_nulls ( target jsonb [,strip_in_arrays boolean] ) → jsonb 181 次
递归地删除给定 JSON 值中所有值为 null 的对象字段。 现存
jsonb_to_record 1 jsonb_to_record ( jsonb ) → record —
将顶级JSON对象展开为具有由 AS子句定义的复合类型的行。 现存
jsonb_to_recordset 1 jsonb_to_recordset ( jsonb ) → setof record —
将顶级JSON对象数组展开为一组由AS子句定义的复合类型的行。 现存
jsonb_typeof 1 jsonb_typeof ( jsonb ) → text —
以文本字符串形式返回顶级JSON值的类型。 现存
row_to_json 1 row_to_json ( record [, boolean] ) → json 9.42 次
将SQL 复合值转换为JSON对象。 现存
to_json 1 to_json ( anyelement ) → json 9.41 次
将任何SQL值转换为json或jsonb。 现存
to_jsonb 1 to_jsonb ( anyelement ) → jsonb —
将任何SQL值转换为json或jsonb。 现存
SEQUENCE MANIPULATION FUNCTIONS 序列操作函数 5 个 ↑
currval基线 1 currval ( regclass ) → bigint —
返回当前会话中最近一次针对该序列调用nextval所获得的值。 现存
lastval基线 1 lastval () → bigint —
返回nextval在当前会话中最近返回的值。 现存
nextval基线 1 nextval ( regclass ) → bigint —
将序列对象推进到下一个值并返回该值。 现存
pg_get_sequence_data 1 pg_get_sequence_data ( regclass ) → record ( last_value bigint, is_called bool, page_lsn pg_lsn ) —
返回有关序列的信息。 现存
setval基线 1 setval ( regclass, bigint [, boolean] ) → bigint —
设置序列对象的当前值,并可选地设置其is_called标志。 现存
CONDITIONAL EXPRESSIONS 条件表达式 4 个 ↑
COALESCE基线 1 COALESCE(value [, ...]) —
COALESCE函数返回参数中第一个不为 null 的值。 现存
GREATEST基线 1 GREATEST(value [, ...]) —
GREATEST和LEAST函数从由任意数量的表达式组成的列表中选取最大值或最小值。 现存
LEAST基线 1 LEAST(value [, ...]) —
GREATEST和LEAST函数从由任意数量的表达式组成的列表中选取最大值或最小值。 现存
NULLIF基线 1 NULLIF(value1, value2) —
当value1和value2相等时,NULLIF返回 null。 现存
ARRAY FUNCTIONS AND OPERATORS 数组函数和操作符 20 个 ↑
array_append基线 1 array_append ( anycompatiblearray, anycompatible ) → anycompatiblearray 141 次
向一个数组的末端追加一个元素(等同于 anycompatiblearray || anycompatible 操作符)。 现存
array_cat基线 1 array_cat ( anycompatiblearray, anycompatiblearray ) → anycompatiblearray 141 次
连接两个数组(等同于 anycompatiblearray || anycompatiblearray 操作符)。 现存
array_dims基线 1 array_dims ( anyarray ) → text —
返回数组维度的文本表示形式。 现存
array_fill基线 1 array_fill ( anyelement, integer[] [, integer[]] ) → anyarray 9.31 次
返回用给定值的副本填充的数组,各维的长度由第二个参数指定。 现存
array_length基线 1 array_length ( anyarray, integer ) → integer —
返回请求的数组维度的长度。 现存
array_lower基线 1 array_lower ( anyarray, integer ) → integer —
返回请求的数组维度的下界。 现存
array_ndims基线 1 array_ndims ( anyarray ) → integer —
返回数组的维度数。 现存
array_position 1 array_position ( anycompatiblearray, anycompatible [, integer] ) → integer 141 次
返回第二个参数在数组中首次出现的下标;若不存在,则返回NULL。 现存
array_positions 1 array_positions ( anycompatiblearray, anycompatible ) → integer[] 141 次
返回第二个参数在第一个参数所给数组中所有出现位置的下标数组。 现存
array_prepend基线 1 array_prepend ( anycompatible, anycompatiblearray ) → anycompatiblearray 141 次
在数组的开头添加一个元素(等同于anycompatible || anycompatiblearray操作符)。 现存
array_remove 1 array_remove ( anycompatiblearray, anycompatible ) → anycompatiblearray 141 次
从数组中移除与给定值相等的所有元素。 现存
array_replace 1 array_replace ( anycompatiblearray, anycompatible, anycompatible ) → anycompatiblearray 141 次
将等于第二个参数的每个数组元素替换为第三个参数。 现存
array_reverse 1 array_reverse ( anyarray ) → anyarray —
反转数组的第一维。 现存
array_sample 1 array_sample ( array anyarray, n integer ) → anyarray —
从array中随机选取n个项并返回一个数组。 现存
array_shuffle 1 array_shuffle ( anyarray ) → anyarray —
随机打乱数组的第一维。 现存
array_sort 1 array_sort ( array anyarray [, descending boolean [, nulls_first boolean]] ) → anyarray —
对数组的第一维进行排序。 现存
array_to_string基线 1 array_to_string ( array anyarray, delimiter text [, null_string text] ) → text 9.11 次
将每个数组元素转换为其文本表示,并将它们用delimiter字符串分隔连接起来。 现存
array_upper基线 1 array_upper ( anyarray, integer ) → integer —
返回请求的数组维度的上界。 现存
cardinality 1 cardinality ( anyarray ) → integer —
返回数组中元素的总数,如果数组为空则返回0。 现存
trim_array 1 trim_array ( array anyarray, n integer ) → anyarray —
通过删除最后的n个元素来裁剪数组。 现存
RANGE/MULTIRANGE FUNCTIONS AND OPERATORS 范围/多范围函数和操作符 9 个 ↑
isempty 2 isempty ( anyrange ) → boolean 141 次
范围为空吗? 现存
lower_inc 2 lower_inc ( anyrange ) → boolean 141 次
范围的下界是否包含在内? 现存
lower_inf 2 lower_inf ( anyrange ) → boolean 141 次
范围是否没有下界?(下界为-Infinity时返回假。 现存
multirange 1 multirange ( anyrange ) → anymultirange —
返回仅包含给定范围的多范围。 现存
multirange_minus_multi 1 multirange_minus_multi ( anymultirange, anymultirange ) → setof anymultirange —
返回从第一个多范围中减去第二个多范围后剩下的非空多范围。 现存
range_merge 2 range_merge ( anyrange, anyrange ) → anyrange 141 次
计算包含两个给定范围的最小范围。 现存
range_minus_multi 1 range_minus_multi ( anyrange, anyrange ) → setof anyrange —
返回从第一个范围中减去第二个范围后剩下的非空范围。 现存
upper_inc 2 upper_inc ( anyrange ) → boolean 141 次
范围的上界是否包含在内? 现存
upper_inf 2 upper_inf ( anyrange ) → boolean 141 次
范围是否没有上界?(上界为Infinity时返回假。 现存
AGGREGATE FUNCTIONS 聚合函数 56 个 ↑
any_value 1 any_value ( anyelement ) → same as input type —
从非空输入值中返回任意一个值。 现存
array_agg基线 2 array_agg ( anynonarray ORDER BY input_sort_columns ) → anyarray 172 次
将所有输入值,包括空值,收集到一个数组中。 现存
avg基线 7 avg ( smallint ) → numeric —
计算所有非空输入值的平均值(算术平均值)。 现存
bit_and基线 4 bit_and ( smallint ) → smallint —
计算所有非空输入值的按位与。 现存
bit_or基线 4 bit_or ( smallint ) → smallint —
计算所有非空输入值的按位或。 现存
bit_xor 4 bit_xor ( smallint ) → smallint —
计算所有非空输入值的按位异或。 现存
bool_and基线 1 bool_and ( boolean ) → boolean —
如果全部非空输入值都为真则返回真,否则返回假。 现存
bool_or基线 1 bool_or ( boolean ) → boolean —
如果任何非空输入值为真则返回真,否则返回假。 现存
corr基线 1 corr ( Y double precision, X double precision ) → double precision —
计算相关系数。 现存
count基线 2 count ( * ) → bigint —
计算输入行的数量。 现存
covar_pop基线 1 covar_pop ( Y double precision, X double precision ) → double precision —
计算总体协方差。 现存
covar_samp基线 1 covar_samp ( Y double precision, X double precision ) → double precision —
计算样本协方差。 现存
cume_dist基线 2 cume_dist ( args ) WITHIN GROUP ( ORDER BY sorted_args ) → double precision 9.41 次
计算累积分布,也就是(位于假想行之前或与假想行同等的行数)/(总行数)。 现存
dense_rank基线 2 dense_rank ( args ) WITHIN GROUP ( ORDER BY sorted_args ) → bigint 9.41 次
计算假想行的排名,没有空缺;此函数实际上对同等行组进行计数。 现存
every基线 1 every ( boolean ) → boolean —
这是标准 SQL 中与bool_and等价的函数。 现存
GROUPING 1 GROUPING ( group_by_expression(s) ) → integer —
返回一个位掩码,指示哪些GROUP BY表达式未包含在当前分组集中。 现存
json_agg 1 json_agg ( anyelement ORDER BY input_sort_columns ) → json 171 次
将所有输入值(包括空值)收集到一个JSON数组中。 现存
json_agg_strict 1 json_agg_strict ( anyelement ) → json —
将所有非空输入值收集到一个JSON数组中,跳过空值。 现存
json_arrayagg 1 json_arrayagg ( [value_expression] [ORDER BY sort_expression] [ { NULL | ABSENT } ON NULL] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ]) —
行为与json_array相同,只是它作为一个聚合函数,因此只接受一个 value_expression参数。 现存
json_object_agg 1 json_object_agg ( key "any", value "any" ORDER BY input_sort_columns ) → json 171 次
将所有键/值对收集到一个JSON对象中。 现存
json_object_agg_strict 1 json_object_agg_strict ( key "any", value "any" ) → json —
将所有键/值对收集到一个JSON对象中。 现存
json_object_agg_unique 1 json_object_agg_unique ( key "any", value "any" ) → json —
将所有键/值对收集到一个JSON对象中。 现存
json_object_agg_unique_strict 1 json_object_agg_unique_strict ( key "any", value "any" ) → json —
将所有键/值对收集到一个JSON对象中。 现存
json_objectagg 1 json_objectagg ( [ { key_expression { VALUE | ':' } value_expression } ] [ { NULL | ABSENT } ON NULL] [ { WITH | WITHOUT } UNIQUE [KEYS] ] [RETURNING data_type [FORMAT JSON [ENCODING UTF8] ] ]) —
行为与json_object相同,只是它作为一个聚合函数,因此只接受一个 key_expression参数和一个 value_expression参数。 现存
jsonb_agg 1 jsonb_agg ( anyelement ORDER BY input_sort_columns ) → jsonb 171 次
将所有输入值(包括空值)收集到一个JSON数组中。 现存
jsonb_agg_strict 1 jsonb_agg_strict ( anyelement ) → jsonb —
将所有非空输入值收集到一个JSON数组中,跳过空值。 现存
jsonb_object_agg 1 jsonb_object_agg ( key "any", value "any" ORDER BY input_sort_columns ) → jsonb 171 次
将所有键/值对收集到一个JSON对象中。 现存
jsonb_object_agg_strict 1 jsonb_object_agg_strict ( key "any", value "any" ) → jsonb —
将所有键/值对收集到一个JSON对象中。 现存
jsonb_object_agg_unique 1 jsonb_object_agg_unique ( key "any", value "any" ) → jsonb —
将所有键/值对收集到一个JSON对象中。 现存
jsonb_object_agg_unique_strict 1 jsonb_object_agg_unique_strict ( key "any", value "any" ) → jsonb —
将所有键/值对收集到一个JSON对象中。 现存
max基线 1 max ( see text ) → same as input type —
计算非空输入值的最大值。 现存
min基线 1 min ( see text ) → same as input type —
计算非空输入值的最小值。 现存
mode 1 mode () WITHIN GROUP ( ORDER BY anyelement ) → anyelement —
计算众数,即聚合参数中出现次数最多的值(若多个值的出现次数相同且最多,则任意选择其中第一个)。 现存
percent_rank基线 2 percent_rank ( args ) WITHIN GROUP ( ORDER BY sorted_args ) → double precision 9.41 次
计算假想行的相对排名,即(rank - 1)/(总行数 - 1)。 现存
percentile_cont 4 percentile_cont ( fraction double precision ) WITHIN GROUP ( ORDER BY double precision ) → double precision —
计算连续百分位点,该值对应于聚合参数值有序集合中的指定fraction。 现存
percentile_disc 2 percentile_disc ( fraction double precision ) WITHIN GROUP ( ORDER BY anyelement ) → anyelement —
计算离散百分位数,即聚合参数值的有序集合中的第一个值,该值在排序中的位置等于或超过指定的fraction。 现存
range_agg 2 range_agg ( value anyrange ) → anymultirange 151 次
计算非空输入值的并集。 现存
range_intersect_agg 2 range_intersect_agg ( value anyrange ) → anyrange —
计算非空输入值的交集。 现存
rank基线 2 rank ( args ) WITHIN GROUP ( ORDER BY sorted_args ) → bigint 9.41 次
计算假想行的排名,允许空缺;即该行所属同等行组中第一行的行号。 现存
regr_avgx基线 1 regr_avgx ( Y double precision, X double precision ) → double precision —
计算自变量的平均值,即sum(X)/N。 现存
regr_avgy基线 1 regr_avgy ( Y double precision, X double precision ) → double precision —
计算因变量的平均值,即sum(Y)/N。 现存
regr_count基线 1 regr_count ( Y double precision, X double precision ) → bigint —
计算两个输入都非空的行数。 现存
regr_intercept基线 1 regr_intercept ( Y double precision, X double precision ) → double precision —
计算由(X,Y)数值对确定的最小二乘拟合线性方程的 y 轴截距。 现存
regr_r2基线 1 regr_r2 ( Y double precision, X double precision ) → double precision —
计算相关系数的平方。 现存
regr_slope基线 1 regr_slope ( Y double precision, X double precision ) → double precision —
计算由(X,Y)数值对确定的最小二乘拟合线性方程的斜率。 现存
regr_sxx基线 1 regr_sxx ( Y double precision, X double precision ) → double precision —
计算自变量的“平方和”,即sum(X^2) - sum(X)^2/N。 现存
regr_sxy基线 1 regr_sxy ( Y double precision, X double precision ) → double precision —
计算自变量与因变量的“乘积和”,即sum(X*Y) - sum(X) * sum(Y)/N。 现存
regr_syy基线 1 regr_syy ( Y double precision, X double precision ) → double precision —
计算因变量的“平方和”,即sum(Y^2) - sum(Y)^2/N。 现存
stddev基线 1 stddev ( numeric_type ) → double precision for real or double precision, otherwise numeric —
这是stddev_samp的一个历史别名。 现存
stddev_pop基线 1 stddev_pop ( numeric_type ) → double precision for real or double precision, otherwise numeric —
计算输入值的总体标准差。 现存
stddev_samp基线 1 stddev_samp ( numeric_type ) → double precision for real or double precision, otherwise numeric —
计算输入值的样本标准差。 现存
string_agg基线 2 string_agg ( value text, delimiter text ) → text 172 次
将非 NULL 输入值连接成一个字符串。 现存
sum基线 8 sum ( smallint ) → bigint —
计算非空输入值的总和。 现存
var_pop基线 1 var_pop ( numeric_type ) → double precision for real or double precision, otherwise numeric —
计算输入值的总体方差(总体标准差的平方)。 现存
var_samp基线 1 var_samp ( numeric_type ) → double precision for real or double precision, otherwise numeric —
计算输入值的样本方差(样本标准差的平方)。 现存
variance基线 1 variance ( numeric_type ) → double precision for real or double precision, otherwise numeric —
这是 var_samp 的一个历史别名。 现存
WINDOW FUNCTIONS 窗口函数 7 个 ↑
first_value基线 1 first_value ( value anyelement ) [null treatment] → anyelement 191 次
返回在窗口帧的第一行求得的value。 现存
lag基线 1 lag ( value anycompatible [, offset integer [, default anycompatible]] ) [null treatment] → anycompatible 192 次
返回在分区内当前行之前offset行处计算的value;如果没有这样的行,则返回default(其类型必须与value兼容)。 现存
last_value基线 1 last_value ( value anyelement ) [null treatment] → anyelement 191 次
返回在窗口帧的最后一行求得的value。 现存
lead基线 1 lead ( value anycompatible [, offset integer [, default anycompatible]] ) [null treatment] → anycompatible 192 次
返回在分区内当前行之后offset行处计算的value;如果没有这样的行,则返回default(其类型必须与value兼容)。 现存
nth_value基线 1 nth_value ( value anyelement, n integer ) [null treatment] → anyelement 191 次
返回在窗口帧的第n行求得的value(从1开始计数);如果没有这样的行,则返回NULL。 现存
ntile基线 1 ntile ( num_buckets integer ) → integer —
返回从 1 到参数值的整数,将分区尽可能均等地划分。 现存
row_number基线 1 row_number () → bigint —
返回当前行在其分区内的编号,从 1 开始计数。 现存
MERGE SUPPORT FUNCTIONS 合并支持函数 1 个 ↑
merge_action 1 merge_action ( ) → text —
返回为当前行执行的合并操作命令。 现存
SET RETURNING FUNCTIONS 集合返回函数 2 个 ↑
generate_series基线 5 generate_series ( start integer, stop integer [, step integer] ) → setof integer 162 次
从start到stop生成一系列的值,步长为step。 现存
generate_subscripts基线 2 generate_subscripts ( array anyarray, dim integer ) → setof integer —
生成一个包含给定数组第dim维的有效下标的序列。 现存
SYSTEM INFORMATION FUNCTIONS AND OPERATORS 系统信息函数和操作符 145 个 ↑
acldefault 1 acldefault ( type "char", ownerId oid ) → aclitem[] —
构造一个aclitem数组,保存类型为type、属于 OID 为ownerId的角色的对象的默认访问权限。 现存
aclexplode 1 aclexplode ( aclitem[] ) → setof record ( grantor oid, grantee oid, privilege_type text, is_grantable boolean ) —
以行集的形式返回aclitem数组。 现存
col_description基线 1 col_description ( table oid, column integer ) → text —
返回表列的注释,列由所属表的 OID 和列号指定。 现存
current_catalog基线 1 current_catalog → name —
返回当前数据库的名称。 现存
current_database基线 1 current_database () → name —
返回当前数据库的名称。 现存
current_query基线 1 current_query () → text —
返回客户端提交的当前正在执行的查询文本(可能包含多条语句)。 现存
current_role 1 current_role → name —
这个等同于 current_user。 现存
current_schema基线 2 current_schema → name —
返回在搜索路径中的第一个模式的名称(如果搜索路径为空则返回空值)。 现存
current_schemas基线 1 current_schemas ( include_implicit boolean ) → name[] —
返回当前有效搜索路径中所有模式名称的数组,按优先级排序。 现存
current_user基线 1 current_user → name —
返回当前执行上下文的用户名。 现存
format_type基线 1 format_type ( type oid, typemod integer ) → text —
返回由其类型OID和可能的类型修饰符标识的数据类型的SQL名称。 现存
has_any_column_privilege基线 1 has_any_column_privilege ( [user name or oid, ] table text or oid, privilege text ) → boolean —
用户是否对表的至少一列具有权限?如果拥有整个表的权限,或至少一列获得了该权限的列级授权,则返回真。 现存
has_column_privilege基线 1 has_column_privilege ( [user name or oid, ] table text or oid, column text or smallint, privilege text ) → boolean —
用户对指定的表列有权限么?如果对整个表持有权限,或者对列授予了列级别的权限,则会成功。 现存
has_database_privilege基线 1 has_database_privilege ( [user name or oid, ] database text or oid, privilege text ) → boolean —
用户对数据库有权限吗?允许的权限类型为CREATE、CONNECT、TEMPORARY 和 TEMP(相当于 TEMPORARY)。 现存
has_foreign_data_wrapper_privilege基线 1 has_foreign_data_wrapper_privilege ( [user name or oid, ] fdw text or oid, privilege text ) → boolean —
用户是否具有外部数据包装器权限?唯一允许的权限类型为USAGE。 现存
has_function_privilege基线 1 has_function_privilege ( [user name or oid, ] function text or oid, privilege text ) → boolean —
用户对函数有权限吗?唯一允许的权限类型是EXECUTE。 现存
has_language_privilege基线 1 has_language_privilege ( [user name or oid, ] language text or oid, privilege text ) → boolean —
用户对语言有权限吗?唯一允许的权限类型是USAGE。 现存
has_largeobject_privilege 1 has_largeobject_privilege ( [user name or oid, ] largeobject oid, privilege text ) → boolean —
用户是否拥有大对象的权限?可用的权限类型是 SELECT 和 UPDATE。 现存
has_parameter_privilege 1 has_parameter_privilege ( [user name or oid, ] parameter text, privilege text ) → boolean —
用户是否具有配置参数的权限?参数名称不区分大小写。 现存
has_schema_privilege基线 1 has_schema_privilege ( [user name or oid, ] schema text or oid, privilege text ) → boolean —
用户对模式有权限吗?允许的权限类型是CREATE 和USAGE。 现存
has_sequence_privilege基线 1 has_sequence_privilege ( [user name or oid, ] sequence text or oid, privilege text ) → boolean —
用户是否具有序列权限?允许的权限类型为USAGE、SELECT和UPDATE。 现存
has_server_privilege基线 1 has_server_privilege ( [user name or oid, ] server text or oid, privilege text ) → boolean —
用户是否对外部服务器有权限?唯一允许的权限类型是USAGE。 现存
has_table_privilege基线 1 has_table_privilege ( [user name or oid, ] table text or oid, privilege text ) → boolean —
用户对表有权限吗?允许的权限类型有SELECT、INSERT、UPDATE、DELETE、TRUNCATE、REFERENCES、TRIGGER和MAINTAIN。 现存
has_tablespace_privilege基线 1 has_tablespace_privilege ( [user name or oid, ] tablespace text or oid, privilege text ) → boolean —
用户对表空间有权限吗?唯一允许的权限类型是CREATE。 现存
has_type_privilege 1 has_type_privilege ( [user name or oid, ] type text or oid, privilege text ) → boolean —
用户对数据类型有权限吗?唯一允许的权限类型是 USAGE。 现存
icu_unicode_version 1 icu_unicode_version () → text —
如果服务器在构建时启用了 ICU 支持,则返回一个表示 ICU 所使用的 Unicode 版本的字符串;否则返回 NULL。 现存
inet_client_addr基线 1 inet_client_addr () → inet —
返回当前客户端的 IP 地址;如果当前连接通过 Unix 域套接字建立,则返回NULL。 现存
inet_client_port基线 1 inet_client_port () → integer —
返回当前客户端的IP端口号,如果当前连接是通过Unix 域套接字则返回NULL。 现存
inet_server_addr基线 1 inet_server_addr () → inet —
返回服务器接受当前连接的IP地址,如果当前连接是通过Unix 域套接字则返回NULL。 现存
inet_server_port基线 1 inet_server_port () → integer —
返回服务器接受当前连接的IP端口号,如果当前连接是通过Unix 域套接字则返回NULL。 现存
makeaclitem 1 makeaclitem ( grantee oid, grantor oid, privileges text, is_grantable boolean ) → aclitem —
使用给定的属性构造aclitem。 现存
mxid_age 1 mxid_age ( xid ) → integer —
返回给定多事务 ID 与当前多事务计数器之间的多事务 ID 数。 现存
obj_description基线 2 obj_description ( object oid, catalog name ) → text —
返回数据库对象的注释,对象由其 OID 和所在系统目录的名称指定。 现存
pg_available_wal_summaries 1 pg_available_wal_summaries () → setof record ( tli bigint, start_lsn pg_lsn, end_lsn pg_lsn ) —
返回数据目录中 pg_wal/summaries下现有 WAL 汇总文件的信息。 现存
pg_backend_pid基线 1 pg_backend_pid () → integer —
返回附加到当前会话的服务器进程的进程ID。 现存
pg_basetype 1 pg_basetype ( regtype ) → regtype —
返回由类型 OID 标识的域的基础类型 OID。 现存
pg_blocking_pids 1 pg_blocking_pids ( integer ) → integer[] —
返回一个数组,包含阻止指定进程 ID 对应的服务器进程获取锁的会话进程 ID;如果不存在这样的服务器进程,或该进程未被阻塞,则返回空数组。 现存
pg_char_to_encoding 1 pg_char_to_encoding ( encoding name ) → integer —
将提供的编码名称转换为表示在某些系统目录表中使用的内部标识符的整数。 现存
pg_collation_is_visible 1 pg_collation_is_visible ( collation oid ) → boolean —
排序规则在搜索路径中可见吗? 现存
pg_conf_load_time基线 1 pg_conf_load_time () → timestamp with time zone —
返回服务器配置文件最近一次加载的时间。 现存
pg_control_checkpoint 1 pg_control_checkpoint () → record —
返回有关当前检查点状态的信息,如表 9.90所展示。 现存
pg_control_init 1 pg_control_init () → record —
返回有关集簇初始化状态的信息,如表 9.92所展示。 现存
pg_control_recovery 1 pg_control_recovery () → record —
返回有关恢复状态的信息,如表 9.93所展示。 现存
pg_control_system 1 pg_control_system () → record —
返回有关当前控制文件状态的信息,如表 9.91所展示。 现存
pg_conversion_is_visible基线 1 pg_conversion_is_visible ( conversion oid ) → boolean —
转换在搜索路径中可见吗? 现存
pg_current_logfile 1 pg_current_logfile ( [text] ) → text —
返回当前由日志收集器使用的日志文件的路径名。 现存
pg_current_snapshot 1 pg_current_snapshot () → pg_snapshot —
返回当前快照,即显示哪些事务 ID 正在进行中的数据结构。 现存
pg_current_xact_id 1 pg_current_xact_id () → xid8 —
返回当前事务的ID。 现存
pg_current_xact_id_if_assigned 1 pg_current_xact_id_if_assigned () → xid8 —
返回当前事务的 ID;如果尚未分配 ID,则返回NULL。 现存
pg_describe_object 1 pg_describe_object ( classid oid, objid oid, objsubid integer ) → text 9.51 次
返回数据库对象的文本描述,对象由系统目录 OID、对象 OID 和子对象 ID 指定(例如表中的列号;引用整个对象时,子对象 ID 为零)。 现存
pg_encoding_to_char 1 pg_encoding_to_char ( encoding integer ) → name —
将在某些系统目录表中用作编码内部标识符的整数转换为可读的字符串。 现存
pg_function_is_visible基线 1 pg_function_is_visible ( function oid ) → boolean —
函数在搜索路径中可见吗?(这也适用于过程和聚合。 现存
pg_get_acl 1 pg_get_acl ( classid oid, objid oid, objsubid integer ) → aclitem[] —
返回由系统目录 OID、对象 OID 和子对象 ID 指定的数据库对象的ACL。 现存
pg_get_catalog_foreign_keys 1 pg_get_catalog_foreign_keys () → setof record ( fktable regclass, fkcols text[], pktable regclass, pkcols text[], is_array boolean, is_opt boolean ) —
返回一组记录,描述存在于PostgreSQL系统目录中的外键关系。 现存
pg_get_constraintdef基线 1 pg_get_constraintdef ( constraint oid [, pretty boolean] ) → text —
重建约束的创建命令。 现存
pg_get_database_ddl 1 pg_get_database_ddl ( database regdatabase [, pretty boolean DEFAULT false] [, owner boolean DEFAULT true] [, tablespace boolean DEFAULT true] ) → setof text —
重建指定数据库的CREATE DATABASE语句,随后返回用于连接数上限、模板状态和配置设置的 ALTER DATABASE语句。 现存
pg_get_expr基线 1 pg_get_expr ( expr pg_node_tree, relation oid [, pretty boolean] ) → text 9.11 次
反编译存储在系统目录中的表达式的内部形式,例如列的默认值。 现存
pg_get_function_arguments基线 1 pg_get_function_arguments ( func oid ) → text —
重建函数或过程的参数列表,采用其在CREATE FUNCTION中应有的形式(包括默认值)。 现存
pg_get_function_identity_arguments基线 1 pg_get_function_identity_arguments ( func oid ) → text —
重建标识函数或过程所需的参数列表,采用其在ALTER FUNCTION等命令中应有的形式。 现存
pg_get_function_result基线 1 pg_get_function_result ( func oid ) → text —
重建函数的RETURNS子句,采用其在CREATE FUNCTION中应有的形式。 现存
pg_get_functiondef基线 1 pg_get_functiondef ( func oid ) → text —
重建函数或过程的创建命令。 现存
pg_get_indexdef基线 1 pg_get_indexdef ( index oid [, column integer, pretty boolean] ) → text —
重建索引的创建命令。 现存
pg_get_keywords基线 1 pg_get_keywords () → setof record ( word text, catcode "char", barelabel boolean, catdesc text, baredesc text ) 141 次
返回描述服务器所识别 SQL 关键字的一组记录。 现存
pg_get_loaded_modules 1 pg_get_loaded_modules () → setof record ( module_name text, version text, file_name text ) —
返回当前服务器会话中已加载的可加载模块列表。 现存
pg_get_multixact_members 1 pg_get_multixact_members ( multixid xid ) → setof record ( xid xid, mode text ) —
返回指定多事务 ID 中每个成员的事务 ID 和锁模式。 现存
pg_get_multixact_stats 1 pg_get_multixact_stats () → record ( num_mxids integer, num_members bigint, members_size bigint, oldest_multixact xid ) —
返回当前多事务使用情况的统计信息:num_mxids 是系统中当前存在的多事务 ID 总数,num_members 是系统中当前存在的多事务成员条目总数,members_size 是 pg_multixact/members 目录中 num_members 占用的存储空间,oldest_multixact 是仍在使用的最旧多事务 ID。 现存
pg_get_object_address 1 pg_get_object_address ( type text, object_names text[], object_args text[] ) → record ( classid oid, objid oid, objsubid integer ) 111 次
返回一行,其中包含足以唯一标识数据库对象的信息,该对象由类型代码、对象名称数组和参数数组指定。 现存
pg_get_partition_constraintdef 1 pg_get_partition_constraintdef ( table oid ) → text —
重建分区约束的定义。 现存
pg_get_partkeydef 1 pg_get_partkeydef ( table oid ) → text —
重建分区表的分区键定义,采用其在CREATE TABLE的PARTITION BY子句中的形式。 现存
pg_get_role_ddl 1 pg_get_role_ddl ( role regrole [, pretty boolean DEFAULT false] [, memberships boolean DEFAULT true] ) → setof text —
重建给定角色的CREATE ROLE 语句以及任何ALTER ROLE ... SET 语句。 现存
pg_get_ruledef基线 1 pg_get_ruledef ( rule oid [, pretty boolean] ) → text —
重建规则的创建命令。 现存
pg_get_serial_sequence基线 1 pg_get_serial_sequence ( table text, column text ) → text —
返回与列相关联的序列名称,如果没有序列与该列相关联则返回NULL。 现存
pg_get_statisticsobjdef 1 pg_get_statisticsobjdef ( statobj oid ) → text —
重建扩展统计对象的创建命令。 现存
pg_get_tablespace_ddl 2 pg_get_tablespace_ddl ( tablespace oid [, pretty boolean DEFAULT false] [, owner boolean DEFAULT true] ) → setof text —
重建指定表空间(按 OID 或名称指定)的CREATE TABLESPACE语句。 现存
pg_get_triggerdef基线 1 pg_get_triggerdef ( trigger oid [, pretty boolean] ) → text —
重建触发器的创建命令。 现存
pg_get_userbyid基线 1 pg_get_userbyid ( role oid ) → name —
根据OID返回角色名。 现存
pg_get_viewdef基线 3 pg_get_viewdef ( view oid [, pretty boolean] ) → text 9.21 次
重建定义视图或物化视图的SELECT命令。 现存
pg_get_wal_summarizer_state 1 pg_get_wal_summarizer_state () → record ( summarized_tli bigint, summarized_lsn pg_lsn, pending_lsn pg_lsn, summarizer_pid int ) —
返回有关 WAL 汇总器进度的信息。 现存
pg_has_role基线 1 pg_has_role ( [user name or oid, ] role text or oid, privilege text ) → boolean —
用户是否具有角色权限?允许的权限类型为MEMBER、USAGE和SET。 现存
pg_identify_object 1 pg_identify_object ( classid oid, objid oid, objsubid integer ) → record ( type text, schema text, name text, identity text ) 9.51 次
返回一行,其中包含足以唯一标识数据库对象的信息,该对象由系统目录 OID、对象 OID 和子对象 ID 指定。 现存
pg_identify_object_as_address 1 pg_identify_object_as_address ( classid oid, objid oid, objsubid integer ) → record ( type text, object_names text[], object_args text[] ) —
返回一行,其中包含足以唯一标识数据库对象的信息,该对象由系统目录 OID、对象 OID 和子对象 ID 指定。 现存
pg_index_column_has_property 1 pg_index_column_has_property ( index regclass, column integer, property text ) → boolean —
测试一个索引列是否具有指定名称的属性。 现存
pg_index_has_property 1 pg_index_has_property ( index regclass, property text ) → boolean —
测试一个索引是否具有指定名称的属性。 现存
pg_indexam_has_property 1 pg_indexam_has_property ( am oid, property text ) → boolean —
测试索引访问方法是否具有指定名称的属性。 现存
pg_input_error_info 1 pg_input_error_info ( string text, type text ) → record ( message text, detail text, hint text, sql_error_code text ) —
测试给定的string是否是指定数据类型的有效输入;如果不是,则返回本应抛出的错误详情。 现存
pg_input_is_valid 1 pg_input_is_valid ( string text, type text ) → boolean —
测试给定的string是否是指定数据类型的有效输入,返回 true 或 false。 现存
pg_is_other_temp_schema基线 1 pg_is_other_temp_schema ( oid ) → boolean —
如果给定的OID是另一个会话的临时模式的OID则返回真。 现存
pg_jit_available 1 pg_jit_available () → boolean —
如果JIT编译器扩展可用(参见第 30 章),并且jit配置参数设置为on,则返回真。 现存
pg_last_committed_xact 1 pg_last_committed_xact () → record ( xid xid, timestamp timestamp with time zone, roident oid ) 141 次
返回最近提交事务的事务 ID、提交时间戳和复制源。 现存
pg_listening_channels基线 1 pg_listening_channels () → setof text —
返回当前会话正在侦听的异步通知通道的名称集。 现存
pg_my_temp_schema基线 1 pg_my_temp_schema () → oid —
返回当前会话的临时模式的OID,如果没有则返回0(因为它没有创建任何临时表)。 现存
pg_notification_queue_usage 1 pg_notification_queue_usage () → double precision —
返回待处理通知当前占用的空间占异步通知队列最大容量的比例(0–1)。 现存
pg_numa_available 1 pg_numa_available () → boolean —
如果服务器在编译时启用了 NUMA 支持,则返回真。 现存
pg_opclass_is_visible基线 1 pg_opclass_is_visible ( opclass oid ) → boolean —
操作符类在搜索路径中可见吗? 现存
pg_operator_is_visible基线 1 pg_operator_is_visible ( operator oid ) → boolean —
操作符在搜索路径中可见吗? 现存
pg_opfamily_is_visible 1 pg_opfamily_is_visible ( opclass oid ) → boolean —
操作符族在搜索路径中可见吗? 现存
pg_options_to_table 1 pg_options_to_table ( options_array text[] ) → setof record ( option_name text, option_value text ) —
返回源自pg_class.reloptions 或 pg_attribute.attoptions的值表示的存储选项集。 现存
pg_postmaster_start_time基线 1 pg_postmaster_start_time () → timestamp with time zone —
返回服务器启动时的时间。 现存
pg_safe_snapshot_blocking_pids 1 pg_safe_snapshot_blocking_pids ( integer ) → integer[] —
返回一个数组,包含阻止指定进程 ID 对应的服务器进程获取安全快照的会话进程 ID;如果不存在这样的服务器进程,或该进程未被阻塞,则返回空数组。 现存
pg_settings_get_flags 1 pg_settings_get_flags ( guc text ) → text[] —
返回与给定 GUC 关联的标志数组;如果该 GUC 不存在,则返回NULL。 现存
pg_snapshot_xip 1 pg_snapshot_xip ( pg_snapshot ) → setof xid8 —
返回快照中包含的正在进行的事务 ID集。 现存
pg_snapshot_xmax 1 pg_snapshot_xmax ( pg_snapshot ) → xid8 —
返回快照的xmax。 现存
pg_snapshot_xmin 1 pg_snapshot_xmin ( pg_snapshot ) → xid8 —
返回快照的xmin。 现存
pg_statistics_obj_is_visible 1 pg_statistics_obj_is_visible ( stat oid ) → boolean —
统计对象在搜索路径中可见吗? 现存
pg_table_is_visible基线 1 pg_table_is_visible ( table oid ) → boolean —
表在搜索路径中可见吗?(这适用于所有类型的关系,包括视图、物化视图、索引、序列和外部表。 现存
pg_tablespace_databases基线 1 pg_tablespace_databases ( tablespace oid ) → setof oid —
返回在指定表空间中存储了对象的数据库 OID 集合。 现存
pg_tablespace_location 1 pg_tablespace_location ( tablespace oid ) → text —
返回表空间所在的文件系统路径。 现存
pg_trigger_depth 1 pg_trigger_depth () → integer —
返回PostgreSQL触发器的当前嵌套层级(如果不是从触发器内部直接或间接调用,则为 0)。 现存
pg_ts_config_is_visible基线 1 pg_ts_config_is_visible ( config oid ) → boolean —
全文检索配置是否在搜索路径中可见? 现存
pg_ts_dict_is_visible基线 1 pg_ts_dict_is_visible ( dict oid ) → boolean —
全文检索词典是否在搜索路径中可见? 现存
pg_ts_parser_is_visible基线 1 pg_ts_parser_is_visible ( parser oid ) → boolean —
全文检索解析器是否在搜索路径中可见? 现存
pg_ts_template_is_visible基线 1 pg_ts_template_is_visible ( template oid ) → boolean —
全文检索模板是否在搜索路径中可见? 现存
pg_type_is_visible基线 1 pg_type_is_visible ( type oid ) → boolean —
类型(或域)在搜索路径中可见吗? 现存
pg_typeof基线 1 pg_typeof ( "any" ) → regtype —
返回所传入值的数据类型的 OID。 现存
pg_visible_in_snapshot 1 pg_visible_in_snapshot ( xid8, pg_snapshot ) → boolean —
根据此快照,给定的事务 ID 是否可见(即该事务是否在生成快照之前完成)?注意,此函数无法为子事务 ID(subxid)给出正确结果;详见第 67.3 节。 现存
pg_wal_summary_contents 1 pg_wal_summary_contents ( tli bigint, start_lsn pg_lsn, end_lsn pg_lsn ) → setof record ( relfilenode oid, reltablespace oid, reldatabase oid, relforknumber smallint, relblocknumber bigint, is_limit_block boolean ) —
返回由 TLI 以及起始和结束 LSN 标识的单个 WAL 汇总文件内容的信息。 现存
pg_xact_commit_timestamp 1 pg_xact_commit_timestamp ( xid ) → timestamp with time zone —
返回事务的提交时间戳。 现存
pg_xact_commit_timestamp_origin 1 pg_xact_commit_timestamp_origin ( xid ) → record ( timestamp timestamp with time zone, roident oid) —
返回事务的提交时间戳和复制源。 现存
pg_xact_status 1 pg_xact_status ( xid8 ) → text —
报告近期事务的提交状态。 现存
row_security_active 1 row_security_active ( table text or oid ) → boolean —
在当前用户和当前环境的上下文中,指定表的行级安全是否生效? 现存
session_user基线 1 session_user → name —
返回会话用户名。 现存
shobj_description基线 1 shobj_description ( object oid, catalog name ) → text —
返回共享数据库对象的注释,对象由其 OID 和所在系统目录的名称指定。 现存
system_user 1 system_user → text —
返回用户在被分配数据库角色之前,于认证周期中提供的认证方法和身份(如果有)。 现存
to_regclass 1 to_regclass ( text ) → regclass —
将文本关系名转换为它的OID。 现存
to_regcollation 1 to_regcollation ( text ) → regcollation —
将文本排序规则名称转换为它的OID。 现存
to_regdatabase 1 to_regdatabase ( text ) → regdatabase —
将文本数据库名转换为它的OID。 现存
to_regnamespace 1 to_regnamespace ( text ) → regnamespace —
将文本模式名转换为它的OID。 现存
to_regoper 1 to_regoper ( text ) → regoper —
将文本操作符名称转换为它的OID。 现存
to_regoperator 1 to_regoperator ( text ) → regoperator —
将文本操作符名称(带有参数类型)转换为其OID。 现存
to_regproc 1 to_regproc ( text ) → regproc —
将文本函数或过程名转换为其OID。 现存
to_regprocedure 1 to_regprocedure ( text ) → regprocedure —
将文本函数或过程名(带有参数类型)转换为其OID。 现存
to_regrole 1 to_regrole ( text ) → regrole —
将文本角色名转换为它的OID。 现存
to_regtype 1 to_regtype ( text ) → regtype —
解析文本字符串,从中提取可能的类型名,并将该名称转换为类型 OID。 现存
to_regtypemod 1 to_regtypemod ( text ) → integer —
解析文本字符串,从中提取可能的类型名称,并转换其类型修饰符(如果有)。 现存
txid_current基线 1 txid_current () → bigint —
参见 pg_current_xact_id()。 现存
txid_current_if_assigned 1 txid_current_if_assigned () → bigint —
参见 pg_current_xact_id_if_assigned()。 现存
txid_current_snapshot基线 1 txid_current_snapshot () → txid_snapshot —
参见 pg_current_snapshot()。 现存
txid_snapshot_xip基线 1 txid_snapshot_xip ( txid_snapshot ) → setof bigint —
参见 pg_snapshot_xip()。 现存
txid_snapshot_xmax基线 1 txid_snapshot_xmax ( txid_snapshot ) → bigint —
参见 pg_snapshot_xmax()。 现存
txid_snapshot_xmin基线 1 txid_snapshot_xmin ( txid_snapshot ) → bigint —
参见 pg_snapshot_xmin()。 现存
txid_status 1 txid_status ( bigint ) → text —
参见 pg_xact_status()。 现存
txid_visible_in_snapshot基线 1 txid_visible_in_snapshot ( bigint, txid_snapshot ) → boolean —
参见 pg_visible_in_snapshot()。 现存
unicode_version 1 unicode_version () → text —
返回一个表示PostgreSQL所使用的 Unicode 版本的字符串。 现存
user基线 1 user → name —
这个相当于 current_user。 现存
version基线 1 version () → text —
返回描述PostgreSQL 服务器版本的字符串。 现存
SYSTEM ADMINISTRATION FUNCTIONS 系统管理函数 124 个 ↑
brin_desummarize_range 1 brin_desummarize_range ( index regclass, blockNumber bigint ) → void —
如果存在涵盖指定表块的页面范围摘要,则删除对应的 BRIN 索引元组。 现存
brin_summarize_new_values 1 brin_summarize_new_values ( index regclass ) → integer 9.61 次
扫描指定的BRIN索引以查找基表中当前尚未生成索引摘要的页面范围;对于任何这样的范围,它都通过扫描这些表页来创建一个新的摘要索引元组。 现存
brin_summarize_range 1 brin_summarize_range ( index regclass, blockNumber bigint ) → integer —
对覆盖给定块的页面范围执行摘要(如果尚未摘要)。 现存
current_setting基线 1 current_setting ( setting_name text [, missing_ok boolean] ) → text 9.61 次
返回设置setting_name的当前值。 现存
gin_clean_pending_list 1 gin_clean_pending_list ( index regclass ) → bigint —
将指定 GIN 索引的“待处理”列表中的条目批量移入主 GIN 数据结构,从而清理该列表。 现存
pg_advisory_lock基线 2 pg_advisory_lock ( key bigint ) → void —
获取一个排他的会话级咨询锁,如有必要则等待。 现存
pg_advisory_lock_shared基线 2 pg_advisory_lock_shared ( key bigint ) → void —
获取一个共享的会话级咨询锁,如有必要则等待。 现存
pg_advisory_unlock基线 2 pg_advisory_unlock ( key bigint ) → boolean —
释放以前获取的排他会话级咨询锁。 现存
pg_advisory_unlock_all基线 1 pg_advisory_unlock_all () → void —
释放当前会话所持有的所有会话级咨询锁。 现存
pg_advisory_unlock_shared基线 2 pg_advisory_unlock_shared ( key bigint ) → boolean —
释放以前获取的共享会话级咨询锁。 现存
pg_advisory_xact_lock 2 pg_advisory_xact_lock ( key bigint ) → void —
获取一个排他的事务级咨询锁,如有必要则等待。 现存
pg_advisory_xact_lock_shared 2 pg_advisory_xact_lock_shared ( key bigint ) → void —
获取一个共享的事务级咨询锁,如有必要则等待。 现存
pg_backup_start 1 pg_backup_start ( label text [, fast boolean] ) → pg_lsn —
准备服务器开始在线备份。 现存
pg_backup_start_time 1 pg_backup_start_time () → timestamp with time zone —
如果正在进行在线排他备份,返回其开始时间,否则返回 NULL。 于 15 移除
pg_backup_stop 1 pg_backup_stop ( [wait_for_archive boolean] ) → record ( lsn pg_lsn, labelfile text, spcmapfile text ) —
结束在线备份。 现存
pg_cancel_backend基线 1 pg_cancel_backend ( pid integer ) → boolean —
取消具有指定进程ID的后端进程的会话的当前查询。 现存
pg_clear_attribute_stats 1 pg_clear_attribute_stats ( schemaname text, relname text, attname text, inherited boolean ) → void —
清除给定关系和属性的列级统计信息,就像该表是新创建的一样。 现存
pg_clear_extended_stats 1 pg_clear_extended_stats ( schemaname name, relname name, statistics_schemaname name, statistics_name name, inherited boolean ) → void —
清空扩展统计对象的数据,就像该对象是新建的一样。 现存
pg_clear_relation_stats 1 pg_clear_relation_stats ( schemaname text, relname text ) → void —
清除给定关系的表级统计信息,就像该表是新创建的一样。 现存
pg_collation_actual_version 1 pg_collation_actual_version ( oid ) → text —
返回当前安装在操作系统中的该排序规则对象的实际版本。 现存
pg_column_compression 1 pg_column_compression ( "any" ) → text —
显示用于压缩单个变长值的压缩算法。 现存
pg_column_size基线 1 pg_column_size ( "any" ) → integer —
显示用于存储任何单个数据值的字节数。 现存
pg_column_toast_chunk_id 1 pg_column_toast_chunk_id ( "any" ) → oid8 201 次
显示磁盘上经过TOAST处理的值的chunk_id。 现存
pg_copy_logical_replication_slot 1 pg_copy_logical_replication_slot ( src_slot_name name, dst_slot_name name [, temporary boolean [, plugin name]] ) → record ( slot_name name, lsn pg_lsn ) —
复制一个名为src_slot_name的现有逻辑复制槽到一个名为dst_slot_name的逻辑复制槽,可选地更改输出插件和持久性。 现存
pg_copy_physical_replication_slot 1 pg_copy_physical_replication_slot ( src_slot_name name, dst_slot_name name [, temporary boolean] ) → record ( slot_name name, lsn pg_lsn ) —
将一个名为src_slot_name的现有物理复制槽复制到一个名为dst_slot_name的物理复制槽。 现存
pg_create_logical_replication_slot 1 pg_create_logical_replication_slot ( slot_name name, plugin name [, temporary boolean, twophase boolean, failover boolean] ) → record ( slot_name name, lsn pg_lsn ) 173 次
创建一个名为slot_name的新逻辑(解码)复制槽,使用输出插件plugin。 现存
pg_create_physical_replication_slot 1 pg_create_physical_replication_slot ( slot_name name [, immediately_reserve boolean, temporary boolean] ) → record ( slot_name name, lsn pg_lsn ) 102 次
创建名为 slot_name 的新物理复制槽。 现存
pg_create_restore_point 1 pg_create_restore_point ( name text ) → pg_lsn 9.41 次
在预写式日志中创建一条命名标记记录,供以后用作恢复目标,并返回相应的预写式日志位置。 现存
pg_current_wal_flush_lsn 1 pg_current_wal_flush_lsn () → pg_lsn —
返回当前预写式日志刷盘位置(参见下文说明)。 现存
pg_current_wal_insert_lsn 1 pg_current_wal_insert_lsn () → pg_lsn —
返回当前预写式日志插入位置(参见下文说明)。 现存
pg_current_wal_lsn 1 pg_current_wal_lsn () → pg_lsn —
返回当前预写式日志写入位置(参见下文说明)。 现存
pg_current_xlog_flush_location 1 pg_current_xlog_flush_location ( ) → pg_lsn —
获取当前预写式日志刷盘位置 于 10 移除
pg_current_xlog_insert_location基线 1 pg_current_xlog_insert_location ( ) → pg_lsn 9.41 次
获取当前预写式日志插入位置 于 10 移除
pg_current_xlog_location基线 1 pg_current_xlog_location ( ) → pg_lsn 9.41 次
获取当前预写式日志写入位置 于 10 移除
pg_database_collation_actual_version 1 pg_database_collation_actual_version ( oid ) → text —
返回数据库当前在操作系统中安装的排序规则的实际版本。 现存
pg_database_size基线 2 pg_database_size ( name ) → bigint —
计算具有指定名称或OID的数据库使用的总磁盘空间。 现存
pg_disable_data_checksums 1 pg_disable_data_checksums () → void —
为集簇禁用数据校验和的计算与验证。 现存
pg_drop_replication_slot 1 pg_drop_replication_slot ( slot_name name ) → void —
删除名为slot_name的物理或逻辑复制槽。 现存
pg_enable_data_checksums 1 pg_enable_data_checksums ( [cost_delay int [, cost_limit int]] ) → void —
启动为集簇启用数据校验和的过程。 现存
pg_export_snapshot 1 pg_export_snapshot () → text —
保存事务的当前快照并返回text字符串以标识该快照。 现存
pg_filenode_relation 1 pg_filenode_relation ( tablespace oid, filenode oid ) → regclass —
根据关系所在表空间的 OID 和文件节点返回该关系的 OID。 现存
pg_get_wal_replay_pause_state 1 pg_get_wal_replay_pause_state () → text —
返回恢复暂停状态。 现存
pg_get_wal_resource_managers 1 pg_get_wal_resource_managers () → setof record ( rm_id integer, rm_name text, rm_builtin boolean ) —
返回系统中当前加载的 WAL 资源管理器。 现存
pg_import_system_collations 1 pg_import_system_collations ( schema regnamespace ) → integer —
根据操作系统中找到的所有区域设置,向系统目录pg_collation添加排序规则。 现存
pg_indexes_size基线 1 pg_indexes_size ( regclass ) → bigint —
计算附加到指定表的索引所使用的总磁盘空间。 现存
pg_is_in_backup 1 pg_is_in_backup () → boolean —
如果正在进行在线排他备份,则返回 true。 于 15 移除
pg_is_in_recovery基线 1 pg_is_in_recovery () → boolean —
如果恢复仍在进行则返回真。 现存
pg_is_wal_replay_paused 1 pg_is_wal_replay_paused () → boolean —
如果已请求暂停恢复,则返回真。 现存
pg_is_xlog_replay_paused 1 pg_is_xlog_replay_paused ( ) → bool —
如果恢复已暂停,则为真。 于 10 移除
pg_last_wal_receive_lsn 1 pg_last_wal_receive_lsn () → pg_lsn —
返回流复制最近接收并同步到磁盘的预写式日志位置。 现存
pg_last_wal_replay_lsn 1 pg_last_wal_replay_lsn () → pg_lsn —
返回恢复期间最近重放的预写式日志位置。 现存
pg_last_xact_replay_timestamp 1 pg_last_xact_replay_timestamp () → timestamp with time zone —
返回恢复期间最近重放事务的时间戳,即该事务的提交或中止 WAL 记录在主库上生成的时间。 现存
pg_last_xlog_receive_location基线 1 pg_last_xlog_receive_location ( ) → pg_lsn 9.41 次
获取流复制最近接收并同步到磁盘的预写式日志位置。 于 10 移除
pg_last_xlog_replay_location基线 1 pg_last_xlog_replay_location ( ) → pg_lsn 9.41 次
获取恢复期间最近重放的预写式日志位置。 于 10 移除
pg_log_backend_memory_contexts 1 pg_log_backend_memory_contexts ( pid integer ) → boolean —
请求记录具有指定进程 ID 的后端进程的内存上下文。 现存
pg_log_standby_snapshot 1 pg_log_standby_snapshot () → pg_lsn —
为进行中的事务拍摄快照并将其写入 WAL,无须等待后台写入器或检查点进程记录快照。 现存
pg_logical_emit_message 2 pg_logical_emit_message ( transactional boolean, prefix text, content text [, flush boolean DEFAULT false] ) → pg_lsn 171 次
发出逻辑解码消息。 现存
pg_logical_slot_get_binary_changes 1 pg_logical_slot_get_binary_changes ( slot_name name, upto_lsn pg_lsn, upto_nchanges integer, VARIADIC options text[] ) → setof record ( lsn pg_lsn, xid xid, data bytea ) 101 次
行为就像pg_logical_slot_get_changes()函数,不过改变会以bytea返回。 现存
pg_logical_slot_get_changes 1 pg_logical_slot_get_changes ( slot_name name, upto_lsn pg_lsn, upto_nchanges integer, VARIADIC options text[] ) → setof record ( lsn pg_lsn, xid xid, data text ) 101 次
返回槽 slot_name 中自上次消费更改的位置起的更改。 现存
pg_logical_slot_peek_binary_changes 1 pg_logical_slot_peek_binary_changes ( slot_name name, upto_lsn pg_lsn, upto_nchanges integer, VARIADIC options text[] ) → setof record ( lsn pg_lsn, xid xid, data bytea ) 101 次
行为就像pg_logical_slot_peek_changes()函数,不过改变会以bytea返回。 现存
pg_logical_slot_peek_changes 1 pg_logical_slot_peek_changes ( slot_name name, upto_lsn pg_lsn, upto_nchanges integer, VARIADIC options text[] ) → setof record ( lsn pg_lsn, xid xid, data text ) 101 次
行为就像pg_logical_slot_get_changes()函数,不过改变不会被消费,即在未来的调用中还会返回这些改变。 现存
pg_ls_archive_statusdir 1 pg_ls_archive_statusdir () → setof record ( name text, size bigint, modification timestamp with time zone ) —
返回服务器 WAL 归档状态目录(pg_wal/archive_status)中每个普通文件的名称、大小和最后修改时间(mtime)。 现存
pg_ls_dir基线 1 pg_ls_dir ( dirname text [, missing_ok boolean, include_dot_dirs boolean] ) → setof text 9.51 次
返回指定目录中所有文件的名称(包括目录及其他特殊文件)。 现存
pg_ls_logdir 1 pg_ls_logdir () → setof record ( name text, size bigint, modification timestamp with time zone ) —
返回服务器日志目录中每个普通文件的名称、大小和最后修改时间(mtime)。 现存
pg_ls_logicalmapdir 1 pg_ls_logicalmapdir () → setof record ( name text, size bigint, modification timestamp with time zone ) —
返回服务器的pg_logical/mappings目录中每个普通文件的名称、大小和最后修改时间(mtime)。 现存
pg_ls_logicalsnapdir 1 pg_ls_logicalsnapdir () → setof record ( name text, size bigint, modification timestamp with time zone ) —
返回服务器的pg_logical/snapshots目录中每个普通文件的名称、大小和最后修改时间(mtime)。 现存
pg_ls_replslotdir 1 pg_ls_replslotdir ( slot_name text ) → setof record ( name text, size bigint, modification timestamp with time zone ) —
返回服务器的pg_replslot/slot_name目录中每个普通文件的名称、大小和最后修改时间(mtime),其中slot_name是作为函数输入提供的复制槽的名称。 现存
pg_ls_summariesdir 1 pg_ls_summariesdir () → setof record ( name text, size bigint, modification timestamp with time zone ) —
返回服务器 WAL 摘要目录(pg_wal/summaries)中每个普通文件的名称、大小和最后修改时间(mtime)。 现存
pg_ls_tmpdir 1 pg_ls_tmpdir ( [tablespace oid] ) → setof record ( name text, size bigint, modification timestamp with time zone ) —
返回针对指定tablespace的临时文件目录中每个普通文件的名称、大小和最后修改时间(mtime)。 现存
pg_ls_waldir 1 pg_ls_waldir () → setof record ( name text, size bigint, modification timestamp with time zone ) —
返回服务器的预写式日志(WAL)目录中每个普通文件的名称、大小和最后修改时间(mtime)。 现存
pg_partition_ancestors 1 pg_partition_ancestors ( regclass ) → setof regclass —
列出给定分区的祖先关系,包括关系本身。 现存
pg_partition_root 1 pg_partition_root ( regclass ) → regclass —
返回给定关系所属的分区树的最顶级父节点。 现存
pg_partition_tree 1 pg_partition_tree ( regclass ) → setof record ( relid regclass, parentrelid regclass, isleaf boolean, level integer ) —
列出给定分区表或分区索引的分区树中的表或索引,每行对应一个分区。 现存
pg_promote 1 pg_promote ( wait boolean DEFAULT true, wait_seconds integer DEFAULT 60 ) → boolean —
将备库提升为主库状态。 现存
pg_read_binary_file 1 pg_read_binary_file ( filename text [, offset bigint, length bigint] [, missing_ok boolean] ) → bytea 162 次
返回文件的全部或部分。 现存
pg_read_file基线 1 pg_read_file ( filename text [, offset bigint, length bigint] [, missing_ok boolean] ) → text 163 次
返回一个文本文件的全部或部分,从给定的字节offset开始,最多返回length字节(如果先到达文件末尾,则返回更少)。 现存
pg_relation_filenode基线 1 pg_relation_filenode ( relation regclass ) → oid —
返回当前分配给指定关系的“文件节点”编号。 现存
pg_relation_filepath基线 1 pg_relation_filepath ( relation regclass ) → text —
返回关系的完整文件路径名称(相对于数据库集簇的数据目录,即PGDATA)。 现存
pg_relation_size基线 1 pg_relation_size ( relation regclass [, fork text] ) → bigint —
计算指定关系的一个“分支”所使用的磁盘空间。 现存
pg_reload_conf基线 1 pg_reload_conf () → boolean —
使PostgreSQL服务器的所有进程重新加载其配置文件。 现存
pg_replication_origin_advance 1 pg_replication_origin_advance ( node_name text, lsn pg_lsn ) → void 101 次
将给定节点的复制进度设置为给定的位置。 现存
pg_replication_origin_create 1 pg_replication_origin_create ( node_name text ) → oid —
用给定的外部名称创建一个复制源,并且返回分配给它的内部 ID。 现存
pg_replication_origin_drop 1 pg_replication_origin_drop ( node_name text ) → void —
删除一个以前创建的复制源,包括任何相关的重放进度。 现存
pg_replication_origin_oid 1 pg_replication_origin_oid ( node_name text ) → oid —
通过名称查找复制源并返回其内部ID。 现存
pg_replication_origin_progress 1 pg_replication_origin_progress ( node_name text, flush boolean ) → pg_lsn —
返回给定复制源的重放位置。 现存
pg_replication_origin_session_is_setup 1 pg_replication_origin_session_is_setup () → boolean —
如果在当前会话中选择了复制源则返回真。 现存
pg_replication_origin_session_progress 1 pg_replication_origin_session_progress ( flush boolean ) → pg_lsn —
返回当前会话中选择的复制源的重放位置。 现存
pg_replication_origin_session_reset 1 pg_replication_origin_session_reset () → void —
取消pg_replication_origin_session_setup()的效果。 现存
pg_replication_origin_session_setup 1 pg_replication_origin_session_setup ( node_name text [, pid integer DEFAULT 0] ) → void 191 次
将当前会话标记为从给定的复制源重放,从而允许跟踪重放进度。 现存
pg_replication_origin_xact_reset 1 pg_replication_origin_xact_reset () → void 9.61 次
取消pg_replication_origin_xact_setup()的效果。 现存
pg_replication_origin_xact_setup 1 pg_replication_origin_xact_setup ( origin_lsn pg_lsn, origin_timestamp timestamp with time zone ) → void —
将当前事务标记为重放在给定LSN和时间戳上提交的事务。 现存
pg_replication_slot_advance 1 pg_replication_slot_advance ( slot_name name, upto_lsn pg_lsn ) → record ( slot_name name, end_lsn pg_lsn ) —
推进名为 slot_name 的复制槽当前已确认的位置。 现存
pg_restore_attribute_stats 1 pg_restore_attribute_stats ( VARIADIC kwargs "any" ) → boolean —
创建或更新列级统计信息。 现存
pg_restore_extended_stats 1 pg_restore_extended_stats ( VARIADIC kwargs "any" ) → boolean —
创建或更新统计对象的统计信息。 现存
pg_restore_relation_stats 1 pg_restore_relation_stats ( VARIADIC kwargs "any" ) → boolean —
更新表级统计信息。 现存
pg_rotate_logfile基线 1 pg_rotate_logfile () → boolean —
通知日志文件管理器立即切换到一个新的输出文件。 现存
pg_size_bytes 1 pg_size_bytes ( text ) → bigint —
将人类可读格式的大小(由pg_size_pretty返回)转换为字节。 现存
pg_size_pretty基线 2 pg_size_pretty ( bigint ) → text 9.21 次
将字节大小转换为更易于人类阅读的格式,带有大小单位(字节,kB,MB,GB,TB或PB)。 现存
pg_split_walfile_name 1 pg_split_walfile_name ( file_name text ) → record ( segment_number numeric, timeline_id bigint ) —
从 WAL 文件名中提取序列号和时间线 ID。 现存
pg_start_backup基线 1 pg_start_backup ( label text [, fast boolean [, exclusive boolean ]] ) → pg_lsn 9.62 次
准备服务器开始在线备份。 于 15 移除
pg_stat_file基线 1 pg_stat_file ( filename text [, missing_ok boolean] ) → record ( size bigint, access timestamp with time zone, modification timestamp with time zone, change timestamp with time zone, creation timestamp with time zone, isdir boolean ) 9.51 次
返回一个记录,包含文件大小、最后访问时间戳、最后修改时间戳、最后文件状态变更时间戳(仅限 Unix 平台)、文件创建时间戳(仅限 Windows)以及一个指示其是否为目录的标志。 现存
pg_stop_backup基线 2 pg_stop_backup ( exclusive boolean [, wait_for_archive boolean ] ) → setof record ( lsn pg_lsn, labelfile text, spcmapfile text ) 103 次
结束排他或非排他的在线备份。 于 15 移除
pg_switch_wal 1 pg_switch_wal () → pg_lsn —
强制服务器切换到新的预写式日志文件,使当前文件可以归档(假设正在使用连续归档)。 现存
pg_switch_xlog基线 1 pg_switch_xlog ( ) → pg_lsn 9.41 次
强制切换到新的预写式日志文件(默认仅限超级用户,但可以向其他用户授予EXECUTE权限以运行此函数) 于 10 移除
pg_sync_replication_slots 1 pg_sync_replication_slots () → void —
将逻辑故障切换复制槽从主库同步到备库。 现存
pg_table_size基线 1 pg_table_size ( regclass ) → bigint —
计算指定表所使用的磁盘空间,不包括索引(但包括其 TOAST 表(如有)、空闲空间映射和可见性映射)。 现存
pg_tablespace_size基线 2 pg_tablespace_size ( name ) → bigint —
计算具有指定名称或OID的表空间中使用的总磁盘空间。 现存
pg_terminate_backend基线 1 pg_terminate_backend ( pid integer, timeout bigint DEFAULT 0 ) → boolean 141 次
终止具有指定进程ID的后端进程的会话。 现存
pg_total_relation_size基线 1 pg_total_relation_size ( regclass ) → bigint —
计算指定表所使用的总磁盘空间,包括所有索引和TOAST数据。 现存
pg_try_advisory_lock基线 2 pg_try_advisory_lock ( key bigint ) → boolean —
尝试获取一个排他的会话级咨询锁。 现存
pg_try_advisory_lock_shared基线 2 pg_try_advisory_lock_shared ( key bigint ) → boolean —
尝试获取一个共享的会话级咨询锁。 现存
pg_try_advisory_xact_lock 2 pg_try_advisory_xact_lock ( key bigint ) → boolean —
尝试获取一个排他的事务级咨询锁。 现存
pg_try_advisory_xact_lock_shared 2 pg_try_advisory_xact_lock_shared ( key bigint ) → boolean —
尝试获取一个共享的事务级咨询锁。 现存
pg_wal_lsn_diff 1 pg_wal_lsn_diff ( lsn1 pg_lsn, lsn2 pg_lsn ) → numeric —
计算两个预写式日志位置之间的字节差(lsn1 - lsn2)。 现存
pg_wal_replay_pause 1 pg_wal_replay_pause () → void —
请求暂停恢复。 现存
pg_wal_replay_resume 1 pg_wal_replay_resume () → void —
如果暂停了,则重新启动恢复。 现存
pg_walfile_name 1 pg_walfile_name ( lsn pg_lsn ) → text —
将预写式日志位置转换为包含该位置的 WAL 文件的名称。 现存
pg_walfile_name_offset 1 pg_walfile_name_offset ( lsn pg_lsn ) → record ( file_name text, file_offset integer ) —
将预写式日志位置转换为WAL文件名和该文件中的字节偏移量。 现存
pg_xlog_location_diff 1 pg_xlog_location_diff ( location pg_lsn, location pg_lsn ) → numeric 9.41 次
计算两个事务日志位置之差 于 10 移除
pg_xlog_replay_pause 1 pg_xlog_replay_pause ( ) → void —
立即暂停恢复(默认仅限超级用户,但可以向其他用户授予EXECUTE权限以运行此函数)。 于 10 移除
pg_xlog_replay_resume 1 pg_xlog_replay_resume ( ) → void —
如果恢复已暂停,则重新开始恢复(默认仅限超级用户,但可以向其他用户授予EXECUTE权限以运行此函数)。 于 10 移除
pg_xlogfile_name基线 1 pg_xlogfile_name ( location pg_lsn ) → text 9.41 次
将事务日志位置字符串转换为文件名 于 10 移除
pg_xlogfile_name_offset基线 1 pg_xlogfile_name_offset ( location pg_lsn ) → text, integer 9.41 次
将事务日志位置字符串转换为文件名和文件内的十进制字节偏移量 于 10 移除
set_config基线 1 set_config ( setting_name text, new_value text, is_local boolean ) → text —
将参数setting_name设置为new_value,并返回该值。 现存
TRIGGER FUNCTIONS 触发器函数 3 个 ↑
suppress_redundant_updates_trigger基线 1 suppress_redundant_updates_trigger ( ) → trigger —
抑制不改变数据的更新操作。 现存
tsvector_update_trigger基线 1 tsvector_update_trigger ( ) → trigger —
根据关联的纯文本文档列自动更新tsvector列。 现存
tsvector_update_trigger_column基线 1 tsvector_update_trigger_column ( ) → trigger —
根据关联的纯文本文档列自动更新tsvector列。 现存
EVENT TRIGGER FUNCTIONS 事件触发器函数 4 个 ↑
pg_event_trigger_ddl_commands 1 pg_event_trigger_ddl_commands () → setof record —
当在一个ddl_command_end事件触发器的函数中调用时,pg_event_trigger_ddl_commands返回被每一个用户动作执行的DDL命令的列表。 现存
pg_event_trigger_dropped_objects 1 pg_event_trigger_dropped_objects () → setof record —
在命令的sql_drop事件中调用pg_event_trigger_dropped_objects时,它返回该命令删除的所有对象的列表。 现存
pg_event_trigger_table_rewrite_oid 1 pg_event_trigger_table_rewrite_oid () → oid —
返回将要重写的表的OID。 现存
pg_event_trigger_table_rewrite_reason 1 pg_event_trigger_table_rewrite_reason () → integer —
返回一个说明重写原因的代码。 现存
STATISTICS INFORMATION FUNCTIONS 统计信息函数 1 个 ↑
pg_mcv_list_items 1 pg_mcv_list_items ( pg_mcv_list ) → setof record —
pg_mcv_list_items返回一组记录,描述存储在多列MCV列表中的所有项目。 现存

说明

库里共 707 个函数、18 个大版本、9612 份逐版本快照,最新一版合计 920 条签名;相邻大版本之间记录到 148 处签名变化,16 个函数已经不在最新版本里。「主签名」是该函数在最新收录版本里的第一条签名,完整签名与全部重载写在详情页;一个函数出现在多页时,这里归到它最新一版里页面序最靠前的那一组。每行的「版本变动」是一排方格,一格一个大版本,与表头刻度逐格对齐;鼠标停在某一格上会写出它是哪一版、发生了什么。PostgreSQL 13 重排了手册里函数表的写法,签名文本整体改变,那一跳只记函数的增删,不逐条比较签名。数据取自本站手册译文;本站未收录译文的版本按 postgresql.org 的英文原页显示。