I need an event trigger on my RDS Postgres database. Ultimately, I need to be notified whenever there is a change to the schema. In plain old Postgres (i.e. a non-RDS instance) this works fine. However, in RDS running the following:
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 far as I understand the most privileged role on RDS is rds_superuser. I have granted rds_superuser to my account (e.g. grant rds_superuser to someuser;
). Yet I still cannot create the event trigger. I do understand that the rds_superuser is not the same exact role as the pg superuser (which can be confirmed by either running:SHOW is_superuser
or SELECT * FROM pg_user
).
I also understand why RDS might lock-down true superuser privileges, but it seems a pretty significant limitation if I cannot access event triggers. Am I missing something? Is is possible to set an event trigger in Postgres on RDS? If not, is there any alternative to mimic the same functionality? I am aware of RDS Event Notifications, but there does not seem to be any option to subscribe to schema change events.
I know this is an old question but this seems to be supported now.
PostgreSQL versions 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 master user account can be used to create, modify, rename, and delete event triggers. Event triggers are at the DB instance level, so they can apply to all databases on an instance. 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With