选择 打开 改范围 完整检索页

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

文档 / 函数百科 / 9.4 变更

PostgreSQL 9.4 函数变更

相对 PostgreSQL 9.3 的差异:9.4 共有 436 个函数、550 条签名。

换一个对比基准

汇总

  1. 47新增函数
  2. 0移除函数
  3. 28签名变化
  4. 4换了分组

「签名变化」指函数还在,但它的签名有增有删;只改说明文字不计入。「换了分组」指手册把这个函数挪到了另一页。

新增函数47

  • make_date时间/日期函数和操作符

    从年、月和日字段创建日期(负数年份表示BC)

    make_date ( year int, month int, day int ) → date

    1 条签名

  • make_interval时间/日期函数和操作符

    从年、月、周、日、小时、分钟和秒字段创建时间间隔,每个字段默认为0

    make_interval ( years int DEFAULT 0, months int DEFAULT 0, weeks int DEFAULT 0, days int DEFAULT 0, hours int DEFAULT 0, mins int DEFAULT 0, secs double precision DEFAULT 0.0 ) → interval

    1 条签名

  • make_time时间/日期函数和操作符

    从小时、分钟和秒字段创建时间

    make_time ( hour int, min int, sec double precision ) → time

    1 条签名

  • make_timestamp时间/日期函数和操作符

    从年、月、日、小时、分钟和秒字段创建时间戳(负数年份表示BC)

    make_timestamp ( year int, month int, day int, hour int, min int, sec double precision ) → timestamp

    1 条签名

  • make_timestamptz时间/日期函数和操作符

    从年,月,日,小时,分钟和秒字段结合时区创建时间戳(负数年份表示BC)。

    make_timestamptz ( year int, month int, day int, hour int, min int, sec double precision, [ timezone text ] ) → timestamp with time zone

    1 条签名

  • pg_sleep_for时间/日期函数和操作符

    pg_sleep使当前会话的进程休眠,直到过去给定的秒数。

    pg_sleep_for(interval)

    1 条签名

  • pg_sleep_until时间/日期函数和操作符

    pg_sleep使当前会话的进程休眠,直到过去给定的秒数。

    pg_sleep_until(timestamp with time zone)

    1 条签名

  • line几何函数和操作符

    将两个点转换成通过它们的直线。

    line ( point, point ) → line

    1 条签名

  • json_array_elements_textJSON 函数和操作符

    将顶级 JSON 数组展开为一组text值。

    json_array_elements_text ( json ) → setof text

    1 条签名

  • json_build_arrayJSON 函数和操作符

    根据可变参数列表构建可能异构类型的JSON数组。

    json_build_array ( VARIADIC "any" )

    1 条签名

  • json_build_objectJSON 函数和操作符

    根据可变参数列表构建一个JSON对象。

    json_build_object ( VARIADIC "any" )

    1 条签名

  • json_objectJSON 函数和操作符

    从文本数组构建JSON对象。

    json_object ( text[] )

    2 条签名

  • json_to_recordJSON 函数和操作符

    将顶级JSON对象展开为具有由 AS子句定义的复合类型的行。

    json_to_record ( json ) → record

    1 条签名

  • json_to_recordsetJSON 函数和操作符

    将顶级JSON对象数组展开为一组由AS子句定义的复合类型的行。

    json_to_recordset ( json ) → setof record

    1 条签名

  • json_typeofJSON 函数和操作符

    以文本字符串形式返回顶级JSON值的类型。

    json_typeof ( json ) → text

    1 条签名

  • jsonb_array_elementsJSON 函数和操作符

    将顶级JSON数组展开为一组JSON值。

    jsonb_array_elements ( jsonb ) → setof json setof jsonb

    1 条签名

  • jsonb_array_elements_textJSON 函数和操作符

    将顶级 JSON 数组展开为一组text值。

    jsonb_array_elements_text ( jsonb ) → setof text

    1 条签名

  • jsonb_array_lengthJSON 函数和操作符

    返回顶层JSON数组中的元素数量。

    jsonb_array_length ( jsonb ) → int

    1 条签名

  • jsonb_eachJSON 函数和操作符

    将顶级JSON对象展开为一组键/值对。

    jsonb_each ( jsonb ) → setof key text, value json setof key text, value jsonb

    1 条签名

  • jsonb_each_textJSON 函数和操作符

    将顶级 JSON 对象展开为一组键/值对。

    jsonb_each_text ( jsonb ) → setof key text, value text

    1 条签名

  • jsonb_extract_pathJSON 函数和操作符

    在指定路径下提取JSON子对象。

    jsonb_extract_path ( from_json jsonb, VARIADIC path_elems text[] ) → json jsonb

    1 条签名

  • jsonb_extract_path_textJSON 函数和操作符

    将指定路径上的 JSON 子对象提取为text。

    jsonb_extract_path_text ( from_json jsonb, VARIADIC path_elems text[] ) → text

    1 条签名

  • jsonb_object_keysJSON 函数和操作符

    返回顶级JSON对象中的键集合。

    jsonb_object_keys ( jsonb ) → setof text

    1 条签名

  • jsonb_populate_recordJSON 函数和操作符

    将顶级 JSON 对象展开为具有 base 参数复合类型的行。

    jsonb_populate_record ( base anyelement, from_json jsonb ) → anyelement

    1 条签名

  • jsonb_populate_recordsetJSON 函数和操作符

    将对象的顶级 JSON 数组展开为一组具有 base 参数复合类型的行。

    jsonb_populate_recordset ( base anyelement, from_json jsonb ) → setof anyelement

    1 条签名

  • jsonb_to_recordJSON 函数和操作符

    将顶级JSON对象展开为具有由 AS子句定义的复合类型的行。

    jsonb_to_record ( jsonb ) → record

    1 条签名

  • jsonb_to_recordsetJSON 函数和操作符

    将顶级JSON对象数组展开为一组由AS子句定义的复合类型的行。

    jsonb_to_recordset ( jsonb ) → setof record

    1 条签名

  • jsonb_typeofJSON 函数和操作符

    以文本字符串形式返回顶级JSON值的类型。

    jsonb_typeof ( jsonb ) → text

    1 条签名

  • cardinality数组函数和操作符

    返回数组中元素的总数,如果数组为空则返回0。

    cardinality ( anyarray ) → int

    1 条签名

  • json_object_agg聚合函数

    将所有键/值对收集到一个JSON对象中。

    json_object_agg ( name, value ) → json

    1 条签名

  • mode聚合函数

    计算mode,即聚合参数最频繁的值(如果有多个相同频繁的值,第一个可以任意选择)。

    mode ( ) WITHIN GROUP (ORDER BY sort_expression) → same as sort expression

    1 条签名

  • percentile_cont聚合函数

    计算连续百分位点,该值对应于聚合参数值有序集合中的指定fraction。

    percentile_cont ( fraction ) WITHIN GROUP (ORDER BY sort_expression) → same as sort expression

    2 条签名

  • percentile_disc聚合函数

    计算离散百分位数,即聚合参数值的有序集合中的第一个值,该值在排序中的位置等于或超过指定的fraction。

    percentile_disc ( fraction ) WITHIN GROUP (ORDER BY sort_expression) → same as sort expression

    2 条签名

  • to_regclass系统信息函数和操作符

    将文本关系名转换为它的OID。

    to_regclass ( rel_name ) → regclass

    1 条签名

  • to_regoper系统信息函数和操作符

    将文本操作符名称转换为它的OID。

    to_regoper ( operator_name ) → regoper

    1 条签名

  • to_regoperator系统信息函数和操作符

    将文本操作符名称(带有参数类型)转换为其OID。

    to_regoperator ( operator_name ) → regoperator

    1 条签名

  • to_regproc系统信息函数和操作符

    将文本函数或过程名转换为其OID。

    to_regproc ( func_name ) → regproc

    1 条签名

  • to_regprocedure系统信息函数和操作符

    将文本函数或过程名(带有参数类型)转换为其OID。

    to_regprocedure ( func_name ) → regprocedure

    1 条签名

  • to_regtype系统信息函数和操作符

    将文本类型名转换为它的OID。

    to_regtype ( type_name ) → regtype

    1 条签名

  • pg_create_logical_replication_slot系统管理函数

    创建一个名为slot_name的新逻辑(解码)复制插槽,使用输出插件plugin。

    pg_create_logical_replication_slot ( slot_name name, plugin name ) → (slot_name name, xlog_position pg_lsn)

    1 条签名

  • pg_create_physical_replication_slot系统管理函数

    创建一个新的名为slot_name的物理复制槽。

    pg_create_physical_replication_slot ( slot_name name ) → (slot_name name, xlog_position pg_lsn)

    1 条签名

  • pg_drop_replication_slot系统管理函数

    丢弃名为slot_name的物理或逻辑复制槽。

    pg_drop_replication_slot ( slot_name name ) → void

    1 条签名

  • pg_filenode_relation系统管理函数

    返回一个给定表空间OID和存储它的文件节点的关系的OID。

    pg_filenode_relation ( tablespace oid, filenode oid ) → regclass

    1 条签名

  • pg_logical_slot_get_binary_changes系统管理函数

    行为就像pg_logical_slot_get_changes()函数, 不过改变会以bytea返回。

    pg_logical_slot_get_binary_changes ( slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[] ) → (location pg_lsn, xid xid, data bytea)

    1 条签名

  • pg_logical_slot_get_changes系统管理函数

    返回槽slot_name中的改变,从最后一次使用更改的点开始。

    pg_logical_slot_get_changes ( slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[] ) → (location pg_lsn, xid xid, data text)

    1 条签名

  • pg_logical_slot_peek_binary_changes系统管理函数

    行为就像pg_logical_slot_peek_changes()函数,不过改变会以bytea返回。

    pg_logical_slot_peek_binary_changes ( slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[] ) → (location pg_lsn, xid xid, data bytea)

    1 条签名

  • pg_logical_slot_peek_changes系统管理函数

    行为就像pg_logical_slot_get_changes()函数, 不过改变不会被消费, 即在未来的调用中还会返回这些改变。

    pg_logical_slot_peek_changes ( slot_name name, upto_lsn pg_lsn, upto_nchanges int, VARIADIC options text[] ) → (location text, xid xid, data text)

    1 条签名

移除函数0

这一版没有移除函数。

签名变化28

函数 分组 增删 第一条新增签名
trim 字符串函数和操作符 +1 trim ( [leading | trailing | both] [from] string [, characters] ) → text
date_trunc 时间/日期函数和操作符 +1 date_trunc ( text, interval ) → interval
unnest 数组函数和操作符 +1 unnest ( anyarray, anyarray [, ...] ) → setof anyelement, anyelement [, ...]
array_to_json JSON 函数和操作符 +1−1 array_to_json ( anyarray [, pretty_bool] )
json_array_elements JSON 函数和操作符 +1−1 json_array_elements ( json ) → setof json setof jsonb
json_each JSON 函数和操作符 +1−1 json_each ( json ) → setof key text, value json setof key text, value jsonb
json_each_text JSON 函数和操作符 +1−1 json_each_text ( json ) → setof key text, value text
json_extract_path JSON 函数和操作符 +1−1 json_extract_path ( from_json json, VARIADIC path_elems text[] ) → json jsonb
json_object_keys JSON 函数和操作符 +1−1 json_object_keys ( json ) → setof text
json_populate_record JSON 函数和操作符 +1−1 json_populate_record ( base anyelement, from_json json ) → anyelement
json_populate_recordset JSON 函数和操作符 +1−1 json_populate_recordset ( base anyelement, from_json json ) → setof anyelement
row_to_json JSON 函数和操作符 +1−1 row_to_json ( record [, pretty_bool] )
to_json JSON 函数和操作符 +1−1 to_json ( anyelement )
cume_dist 聚合函数 +1 cume_dist ( args ) WITHIN GROUP (ORDER BY sorted_args) → double precision
dense_rank 聚合函数 +1 dense_rank ( args ) WITHIN GROUP (ORDER BY sorted_args) → bigint
percent_rank 聚合函数 +1 percent_rank ( args ) WITHIN GROUP (ORDER BY sorted_args) → double precision
rank 聚合函数 +1 rank ( args ) WITHIN GROUP (ORDER BY sorted_args) → bigint
pg_create_restore_point 系统管理函数 +1−1 pg_create_restore_point ( name text ) → pg_lsn
pg_current_xlog_insert_location 系统管理函数 +1−1 pg_current_xlog_insert_location ( ) → pg_lsn
pg_current_xlog_location 系统管理函数 +1−1 pg_current_xlog_location ( ) → pg_lsn
pg_last_xlog_receive_location 系统管理函数 +1−1 pg_last_xlog_receive_location ( ) → pg_lsn
pg_last_xlog_replay_location 系统管理函数 +1−1 pg_last_xlog_replay_location ( ) → pg_lsn
pg_start_backup 系统管理函数 +1−1 pg_start_backup ( label text [, fast boolean ] ) → pg_lsn
pg_stop_backup 系统管理函数 +1−1 pg_stop_backup ( ) → pg_lsn
pg_switch_xlog 系统管理函数 +1−1 pg_switch_xlog ( ) → pg_lsn
pg_xlog_location_diff 系统管理函数 +1−1 pg_xlog_location_diff ( location pg_lsn, location pg_lsn ) → numeric
pg_xlogfile_name 系统管理函数 +1−1 pg_xlogfile_name ( location pg_lsn ) → text
pg_xlogfile_name_offset 系统管理函数 +1−1 pg_xlogfile_name_offset ( location pg_lsn ) → text, integer

换了分组4

4 个函数被手册挪到了另一页