Search code examples
postgresqllogical-replication

Find Replica Identity for a Postgres table


Is there a way to see what kind of replica identity a Postgres table has, whether using pgAdmin or through a query?


Solution

  • You can query the pg_class system catalog:

    SELECT CASE relreplident
              WHEN 'd' THEN 'default'
              WHEN 'n' THEN 'nothing'
              WHEN 'f' THEN 'full'
              WHEN 'i' THEN 'index'
           END AS replica_identity
    FROM pg_class
    WHERE oid = 'mytablename'::regclass;