This is an English translation of a Japanese blog. Some content may not be fully translated.
AWS

Cannot Access pg_replication_origin_status in RDS (PostgreSQL) (permission denied)

Version


rdbtest=> select version();
                                                 version
---------------------------------------------------------------------------------------
 PostgreSQL 10.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5
-11), 64-bit

Issue


When attempting to SELECT from pg_replication_origin_status, a permission denied error occurs. This happens even with the rds_superuser role. This view contains the mapping between the transaction log position (LSN) reflected on the subscriber side and the publisher-side LSN. Not being able to view this information causes operational difficulties during logical replication.

rdbtest=> SELECT * FROM pg_replication_origin_status;
ERROR:  permission denied for relation pg_replication_origin_status

Solution


Use pg_show_replication_origin_status() to retrieve the LSN information.

rdbtest=> select * from pg_show_replication_origin_status();
 local_id | external_id | remote_lsn | local_lsn
----------+-------------+------------+-----------
        1 | pg_43450    | 0/28D70910 | 0/0
(1 row)

References


AWS Developer Forums: RDS Postgres Logical replication access … https://forums.aws.amazon.com/thread.jspa?threadID=301094

Suggest an edit on GitHub