pg_range

A system table storing information about range types

pg_range is a system catalogue table storing information about range types, expanding on their base entry in pg_type.

pg_range was added in PostgreSQL 9.2.

Definition by PostgreSQL version

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)
    

Documentation: 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)
    

Documentation: 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)
    

Documentation: 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)
    

Documentation: 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)
    

Documentation: 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)
    

Documentation: 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)
    

Documentation: 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)
    

Documentation: 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)
    

Documentation: 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)
    

Documentation: 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)
    

Documentation: pg_range

Change history

Examples

Default table contents:

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)

Details of the daterange range type together with the matching row from 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

Categories

Data type, System catalogue

See also

range, multirange, pg_type