Reputation: 655
Can I restrict an event trigger to only capture events when DDL is performed against a specific set of tables?
Upvotes: 1
Views: 214
Reputation: 21326
I don't think you can avoid capturing the event, as the current CREATE EVENT TRIGGER
statement only supports filtering by command tag.
Once you're in the trigger function, you have access to a bit more information, so you could put something like this at the top:
IF EXISTS (
SELECT 1 FROM pg_event_trigger_ddl_commands()
WHERE object_identity NOT IN ('myschema.mytable')
)
THEN
RETURN;
END IF;
Upvotes: 3