pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。
相对 PostgreSQL 7.2 的差异:7.3 共有 141 个函数、189 条签名。
「签名变化」指函数还在,但它的签名有增有删;只改说明文字不计入。「换了分组」指手册把这个函数挪到了另一页。
overlay字符串函数和操作符
用 newsubstring 替换 string 中从第 start 个字符开始、长度为 count 个字符的子字符串。如果省略 count,则默认为 newsubstring 的长度。
overlay ( string placing string from integer [for integer] ) → text
quote_ident字符串函数和操作符
为给定字符串添加适当的引号并返回,使其可用作 SQL 语句字符串中的标识符。仅在必要时(即字符串包含不能用于标识符的字符,或会发生大小写折叠时)添加引号。内嵌的引号会被适当地双写。另见例 41.1。
quote_ident ( string text ) → text
quote_literal字符串函数和操作符
为给定字符串添加适当的引号并返回,使其可用作 SQL 语句字符串中的字符串字面量。内嵌的单引号和反斜杠会被适当地双写。注意,quote_literal 在输入为 null 时返回 null;如果参数可能为 null,quote_nullable 通常更合适。另见例 41.1。
quote_literal ( string text ) → text
replace字符串函数和操作符
将 string 中所有出现的子字符串 from 替换为子字符串 to。
replace ( string text, from text, to text ) → text
split_part字符串函数和操作符
在出现 delimiter 时拆分 string,并返回第 n 个字段(从一开始计数);如果 n 为负数,则返回倒数第 |n| 个字段。
split_part ( string text, delimiter text, column integer ) → text
to_hex字符串函数和操作符
将数字转换为等价的二进制补码的十六进制表示。
to_hex ( number integer or bigint ) → text
get_bit二进制串函数和操作符
从二进制字符串中提取编号为 n 的位。
get_bit ( string, offset ) → integer
get_byte二进制串函数和操作符
从二进制字符串中提取编号为 n 的字节。
get_byte ( string, offset ) → integer
set_bit二进制串函数和操作符
设置二进制字符串中的编号为 n 的位为 newvalue。
set_bit ( string, offset, newvalue ) → bytea
set_byte二进制串函数和操作符
将二进制字符串中编号为 n 的字节设置为 newvalue。
set_byte ( string, offset, newvalue ) → bytea
localtime日期/时间函数和操作符
一天中的当前时刻;参见第 9.9.5 节
localtime → time
localtimestamp日期/时间函数和操作符
当前日期和时间(当前事务开始时);参见第 9.9.5 节
localtimestamp → timestamp
npoints几何函数和操作符
返回点的数量。适用于 path、polygon。
npoints ( path ) → integer
current_database其他函数(历史)
返回当前数据库的名称。(SQL 标准将数据库称为“目录(catalogs)”,因此 current_catalog 是标准中的写法。)
current_database ( ) → name
current_schema其他函数(历史)
返回在搜索路径中的第一个模式的名称(如果搜索路径为空则返回空值)。这个模式将用于没有指定目标模式就创建的任何表或其他已命名对象。
current_schema ( ) → name
current_schemas其他函数(历史)
返回当前有效搜索路径中所有模式名称的数组,按优先级排序。(当前 search_path 设置中不对应于已存在且可搜索的模式的项会被省略。)如果布尔参数为 true,结果还会包含 pg_catalog 等隐式搜索的系统模式。
current_schemas ( boolean ) → name[]
has_database_privilege其他函数(历史)
用户对数据库有权限吗?允许的权限类型为 CREATE、CONNECT、TEMPORARY 和 TEMP(相当于 TEMPORARY)。
has_database_privilege ( user, database, access ) → boolean
has_function_privilege其他函数(历史)
用户对函数有权限吗?唯一允许的权限类型是 EXECUTE。
has_function_privilege ( user, function, access ) → boolean
has_language_privilege其他函数(历史)
用户对语言有权限吗?唯一允许的权限类型是 USAGE。
has_language_privilege ( user, language, access ) → boolean
has_schema_privilege其他函数(历史)
用户对模式有权限吗?允许的权限类型是 CREATE 和 USAGE。
has_schema_privilege ( user, schema, access ) → boolean
pg_function_is_visible其他函数(历史)
函数在搜索路径中可见吗?(这也适用于过程和聚合。)
pg_function_is_visible ( functionOID ) → boolean
pg_get_constraintdef其他函数(历史)
重建约束的创建命令。(这是反编译重建的结果,并非命令的原始文本。)
pg_get_constraintdef ( constraintOID ) → text
pg_opclass_is_visible其他函数(历史)
操作符类在搜索路径中可见吗?
pg_opclass_is_visible ( opclassOID ) → boolean
pg_operator_is_visible其他函数(历史)
操作符在搜索路径中可见吗?
pg_operator_is_visible ( operatorOID ) → boolean
pg_table_is_visible其他函数(历史)
表在搜索路径中可见吗?(这适用于所有类型的关系,包括视图、物化视图、索引、序列和外部表。)
pg_table_is_visible ( tableOID ) → boolean
pg_type_is_visible其他函数(历史)
类型(或域)在搜索路径中可见吗?
pg_type_is_visible ( typeOID ) → boolean
current_setting其他函数(历史)
返回设置 setting_name 的当前值。如果没有这样的设置,current_setting 将抛出一个错误,除非 missing_ok 被提供并且为 true(在此情况下返回 NULL)。这个函数对应于 SQL 命令 SHOW。
current_setting ( setting_name ) → text
set_config其他函数(历史)
将参数 setting_name 设置为 new_value,并返回该值。如果 is_local 为 true,新值仅在当前事务期间生效。如果希望新值在当前会话的剩余时间内生效,则使用 false。此函数对应 SQL 命令 SET。
set_config ( setting_name, new_value, is_local ) → text
timestamp日期/时间函数和操作符
date 转换为 timestamp
timestamp ( date ) → timestamp
npoint几何函数和操作符
点数
npoint ( path ) → integer
| 函数 | 分组 | 增删 | 第一条新增签名 |
|---|---|---|---|
ceil |
数学函数和操作符 | +1−1 | ceil ( dp or numeric ) → (same as input) |
exp |
数学函数和操作符 | +1−1 | exp ( dp or numeric ) → (same as input) |
floor |
数学函数和操作符 | +1−1 | floor ( dp or numeric ) → (same as input) |
ln |
数学函数和操作符 | +1−1 | ln ( dp or numeric ) → (same as input) |
log |
数学函数和操作符 | +1−1 | log ( dp or numeric ) → (same as input) |
pow |
数学函数和操作符 | +2−1 | pow ( x dp, e dp ) → dp |
round |
数学函数和操作符 | +1−1 | round ( dp or numeric ) → (same as input) |
sign |
数学函数和操作符 | +1−1 | sign ( dp or numeric ) → (same as input) |
sqrt |
数学函数和操作符 | +1−1 | sqrt ( dp or numeric ) → (same as input) |
trunc |
数学函数和操作符 | +2−2 | trunc ( dp or numeric ) → (same as input) |
btrim |
字符串函数和操作符 | +1−1 | btrim ( string bytea trim bytea ) → bytea |
ltrim |
字符串函数和操作符 | +1−1 | ltrim ( string text, text text ) → text |
strpos |
字符串函数和操作符 | +1−1 | strpos ( string, substring ) → int |
substring |
字符串函数和操作符 | +2 | substring ( string from pattern ) → text |
convert |
字符串函数和操作符 | +1 | convert ( string using conversion_name ) → text |
current_time |
日期/时间函数和操作符 | +1−1 | current_time → time with time zone |
current_timestamp |
日期/时间函数和操作符 | +2−2 | current_timestamp → timestamp with time zone |
now |
日期/时间函数和操作符 | +1−1 | now ( ) → timestamp with time zone |
COALESCE |
条件表达式 | +1−1 | COALESCE(value [, ...]) |
avg |
聚合函数 | +1−1 | avg ( expression ) → numeric for any integer type argument, double precision for a floating-point argument, otherwise the same as the argument data type |
count |
聚合函数 | +2−2 | count ( * ) → bigint |
max |
聚合函数 | +1−1 | max ( expression ) → same as argument type |
min |
聚合函数 | +1−1 | min ( expression ) → same as argument type |
stddev |
聚合函数 | +1−1 | stddev ( expression ) → double precision for floating-point arguments, otherwise numeric |
sum |
聚合函数 | +1−1 | sum ( expression ) → bigint for smallint or integer arguments, numeric for bigint arguments, double precision for floating-point arguments, otherwise the same as the argument data type |
variance |
聚合函数 | +1−1 | variance ( expression ) → double precision for floating-point arguments, otherwise numeric |
pg_get_ruledef |
其他函数(历史) | +1−1 | pg_get_ruledef ( ruleOID ) → text |
pg_get_viewdef |
其他函数(历史) | +1 | pg_get_viewdef ( viewOID ) → text |
version |
其他函数(历史) | +1−1 | version ( ) → text |
这一版没有函数换分组。