pg_replication_origin_oid()

A function for querying a replication origin's OID

pg_replication_origin_oid() is a system function for querying a replication origin's OID.

pg_replication_origin_oid() was added in PostgreSQL 9.5.

Usage

pg_replication_origin_oid ( node_name text ) → oid

The OID returned is that of the specified node's entry in pg_replication_origin.

If no entry exists with the specified node name, NULL is returned.

Change history

Examples

Basic usage example for pg_replication_origin_oid():

postgres=# SELECT pg_replication_origin_oid('foo');
 pg_replication_origin_oid 
---------------------------
                         1
(1 row)

This is equivalent to:

postgres=# SELECT roident
             FROM pg_replication_origin
            WHERE roname = 'foo';
 roident 
---------
       1
(1 row)

Attempting to retrieve the OID of a non-existent replication origin:

postgres=# SELECT pg_replication_origin_oid('bar') IS NULL;
 ?column? 
----------
 t
(1 row)

Categories

Logical replication, System function