Updated on 2024-09-02 GMT+08:00

PG_SUBSCRIPTION

PG_SUBSCRIPTION records all existing subscriptions.

Table 1 PG_SUBSCRIPTION columns

Name

Type

Reference

Description

oid

oid

-

Row identifier (hidden attribute; displayed only when explicitly selected)

subdbid

oid

PG_DATABASE.oid

OID of the database that the subscription belongs to

subname

name

-

Name of a subscription

subowner

oid

PG_AUTHID.oid

Owner of a subscription

subenabled

boolean

-

If it is true, the subscription is enabled and should be replicated.

subconninfo

text

-

Information about the connection to the database at the publisher end

subslotname

text

-

Name of the replication slot in the publisher database If this parameter is left blank, the value is NONE.

subpublications

text[]

-

Array of subscribed publication names. These are the references to the publications on the publisher server.

Examples

View all subscriptions.

1
2
3
4
5
SELECT * FROM pg_subscription;
 subdbid | subname | subowner | subenabled |                                       subconninfo                                        | subslotname | subpublications 
---------+---------+----------+------------+------------------------------------------------------------------------------------------+-------------+-----------------
   15992 | mysub   |       10 | t          | host=1.1.1.1,2.2.2.2 port=10000,20000 dbname=postgres user=repusr1 password=password_123 | mysub       | {mypub}
(1 row)