pg_range
是一个存储有关范围类型信息的系统目录表,扩展了其在pg_type
中的基本条目。
pg_range
添加于PostgreSQL 9.2。
按 PostgreSQL 版本定义
pg_range (PostgreSQL 17)
Table "pg_catalog.pg_range" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- rngtypid | oid | | not null | rngsubtype | oid | | not null | rngmultitypid | oid | | not null | rngcollation | oid | | not null | rngsubopc | oid | | not null | rngcanonical | regproc | | not null | rngsubdiff | regproc | | not null | Indexes: "pg_range_rngtypid_index" PRIMARY KEY, btree (rngtypid) "pg_range_rngmultitypid_index" UNIQUE CONSTRAINT, btree (rngmultitypid)
文档: pg_range
pg_range (PostgreSQL 16)
Table "pg_catalog.pg_range" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- rngtypid | oid | | not null | rngsubtype | oid | | not null | rngmultitypid | oid | | not null | rngcollation | oid | | not null | rngsubopc | oid | | not null | rngcanonical | regproc | | not null | rngsubdiff | regproc | | not null | Indexes: "pg_range_rngtypid_index" PRIMARY KEY, btree (rngtypid) "pg_range_rngmultitypid_index" UNIQUE CONSTRAINT, btree (rngmultitypid)
文档: pg_range
pg_range (PostgreSQL 15)
Table "pg_catalog.pg_range" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- rngtypid | oid | | not null | rngsubtype | oid | | not null | rngmultitypid | oid | | not null | rngcollation | oid | | not null | rngsubopc | oid | | not null | rngcanonical | regproc | | not null | rngsubdiff | regproc | | not null | Indexes: "pg_range_rngtypid_index" PRIMARY KEY, btree (rngtypid) "pg_range_rngmultitypid_index" UNIQUE CONSTRAINT, btree (rngmultitypid)
文档: pg_range
pg_range (PostgreSQL 14)
Table "pg_catalog.pg_range" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- rngtypid | oid | | not null | rngsubtype | oid | | not null | rngmultitypid | oid | | not null | rngcollation | oid | | not null | rngsubopc | oid | | not null | rngcanonical | regproc | | not null | rngsubdiff | regproc | | not null | Indexes: "pg_range_rngtypid_index" PRIMARY KEY, btree (rngtypid) "pg_range_rngmultitypid_index" UNIQUE CONSTRAINT, btree (rngmultitypid)
文档: pg_range
pg_range (PostgreSQL 13)
Table "pg_catalog.pg_range" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- rngtypid | oid | | not null | rngsubtype | oid | | not null | rngcollation | oid | | not null | rngsubopc | oid | | not null | rngcanonical | regproc | | not null | rngsubdiff | regproc | | not null | Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid)
文档: pg_range
pg_range (PostgreSQL 12)
Table "pg_catalog.pg_range" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- rngtypid | oid | | not null | rngsubtype | oid | | not null | rngcollation | oid | | not null | rngsubopc | oid | | not null | rngcanonical | regproc | | not null | rngsubdiff | regproc | | not null | Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid)
文档: pg_range
pg_range (PostgreSQL 11)
Table "pg_catalog.pg_range" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- rngtypid | oid | | not null | rngsubtype | oid | | not null | rngcollation | oid | | not null | rngsubopc | oid | | not null | rngcanonical | regproc | | not null | rngsubdiff | regproc | | not null | Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid)
文档: pg_range
pg_range (PostgreSQL 10)
Table "pg_catalog.pg_range" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- rngtypid | oid | | not null | rngsubtype | oid | | not null | rngcollation | oid | | not null | rngsubopc | oid | | not null | rngcanonical | regproc | | not null | rngsubdiff | regproc | | not null | Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid)
文档: pg_range
pg_range (PostgreSQL 9.6)
Table "pg_catalog.pg_range" Column | Type | Modifiers --------------+---------+----------- rngtypid | oid | not null rngsubtype | oid | not null rngcollation | oid | not null rngsubopc | oid | not null rngcanonical | regproc | not null rngsubdiff | regproc | not null Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid)
文档: pg_range
pg_range (PostgreSQL 9.5)
Table "pg_catalog.pg_range" Column | Type | Modifiers --------------+---------+----------- rngtypid | oid | not null rngsubtype | oid | not null rngcollation | oid | not null rngsubopc | oid | not null rngcanonical | regproc | not null rngsubdiff | regproc | not null Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid)
文档: pg_range
pg_range (PostgreSQL 9.4)
Table "pg_catalog.pg_range" Column | Type | Modifiers --------------+---------+----------- rngtypid | oid | not null rngsubtype | oid | not null rngcollation | oid | not null rngsubopc | oid | not null rngcanonical | regproc | not null rngsubdiff | regproc | not null Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid)
文档: pg_range
pg_range (PostgreSQL 9.3)
Table "pg_catalog.pg_range" Column | Type | Modifiers --------------+---------+----------- rngtypid | oid | not null rngsubtype | oid | not null rngcollation | oid | not null rngsubopc | oid | not null rngcanonical | regproc | not null rngsubdiff | regproc | not null Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid)
文档: pg_range
pg_range (PostgreSQL 9.2)
Table "pg_catalog.pg_range" Column | Type | Modifiers --------------+---------+----------- rngtypid | oid | not null rngsubtype | oid | not null rngcollation | oid | not null rngsubopc | oid | not null rngcanonical | regproc | not null rngsubdiff | regproc | not null Indexes: "pg_range_rngtypid_index" UNIQUE, btree (rngtypid)
文档: pg_range
更改历史记录
- PostgreSQL 14
- 添加了列
rngmultitypid
(提交6df7a969)
- 添加了列
- PostgreSQL 9.2
- 添加 (提交4429f6a9)
示例
默认表内容
postgres=# SELECT * FROM pg_range; rngtypid | rngsubtype | rngcollation | rngsubopc | rngcanonical | rngsubdiff ----------+------------+--------------+-----------+---------------------+------------------- 3904 | 23 | 0 | 1978 | int4range_canonical | int4range_subdiff 3906 | 1700 | 0 | 3125 | - | numrange_subdiff 3908 | 1114 | 0 | 3128 | - | tsrange_subdiff 3910 | 1184 | 0 | 3127 | - | tstzrange_subdiff 3912 | 1082 | 0 | 3122 | daterange_canonical | daterange_subdiff 3926 | 20 | 0 | 3124 | int8range_canonical | int8range_subdiff (6 rows)
daterange 范围类型以及来自pg_type的匹配行的详细信息
postgres=# SELECT t.*, r.* FROM pg_type t JOIN pg_range r ON r.rngtypid = t.oid WHERE typname='daterange'; -[ RECORD 1 ]--+-------------------- typname | daterange typnamespace | 11 typowner | 10 typlen | -1 typbyval | f typtype | r typcategory | R typispreferred | f typisdefined | t typdelim | , typrelid | 0 typelem | 0 typarray | 3913 typinput | range_in typoutput | range_out typreceive | range_recv typsend | range_send typmodin | - typmodout | - typanalyze | range_typanalyze typalign | i typstorage | x typnotnull | f typbasetype | 0 typtypmod | -1 typndims | 0 typcollation | 0 typdefaultbin | typdefault | typacl | rngtypid | 3912 rngsubtype | 1082 rngcollation | 0 rngsubopc | 3122 rngcanonical | daterange_canonical rngsubdiff | daterange_subdiff
参考文献
- PostgreSQL 文档: pg_range