Creating a Postgres Event Trigger in AWS-RDS

I need an event trigger in my Postgres RDS database. Ultimately, I need to be notified of every change to the schema. On a regular old Postgres (i.e. non-RDS instance) this works fine. However, the following is done in RDS:

CREATE EVENT TRIGGER audit ON ddl_command_start EXECUTE PROCEDURE stat_audit();

Results in:

 ERROR: permission denied to create event trigger HINT: Must be superuser to create an event trigger. 

As I understand it, the most privileged role in RDS is rds_superuser. I provided rds_superuser for my account (e.g. grant rds_superuser to someuser; ). But I still can not create an event trigger. I understand that rds_superuser is not the same as the superuser pg (which can be confirmed either by running: SHOW is_superuser , or SELECT * FROM pg_user ). I also understand why RDS can block true superuser privileges, but this seems like a pretty significant limitation if I cannot access event triggers. Am I missing something? Is it possible to set an event trigger in Postgres on RDS? If not, is there an alternative to mimicking the same functionality? I know RDS event notifications, but there seems to be no way to subscribe to schema change events.

+5
source share
1 answer

I know this is an old question, but now it is supported.

PostgreSQL version 9.4.9 and later and version 9.5.4 and later support event triggers, and Amazon RDS supports event triggers for these versions. The primary user account can be used to create, rename, and delete event triggers. Event triggers are located in the instance-level database, so they can be applied to all instance databases. For more information about PostgreSQL event triggers on Amazon RDS, see Event triggers for PostgreSQL on Amazon RDS.

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.FeatureSupport.EventTriggers

+1
source

Source: https://habr.com/ru/post/1245568/


All Articles