pg_replication_origin_create()

A function for creating a replication origin

pg_replication_origin_create() is a system function for creating a replication origin.

pg_replication_origin_create() was added in PostgreSQL 9.5.

Usage

pg_replication_origin_create ( node_name text ) → oid

This function creates an entry with the provided node_name in pg_replication_origin and returns the OID of the entry.

Change history

Examples

Basic usage example for pg_replication_origin_create():

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

It is not possible to create a replication origin with a duplicate name:

postgres=# SELECT pg_replication_origin_create('foo');
ERROR:  duplicate key value violates unique constraint "pg_replication_origin_roname_index"
DETAIL:  Key (roname)=(foo) already exists.

Categories

Logical replication, System function

See also

pg_replication_origin_drop(), pg_replication_origin