是否可以使用 PostgreSQL 的事件触发器针对一组特定的表捕获 DDL 事件?

Is it possible to capture DDL events against a specific set of tables with PostgreSQL's event triggers?

当针对一组特定表执行 DDL 时,我能否将事件触发器限制为仅捕获事件?

我认为您无法避免捕获该事件,因为当前 CREATE EVENT TRIGGER statement only supports filtering by command tag

进入触发器功能后,您可以访问 a bit more information,因此您可以在顶部放置如下内容:

IF EXISTS (
    SELECT 1 FROM pg_event_trigger_ddl_commands()
    WHERE object_identity NOT IN ('myschema.mytable')
  )
THEN
  RETURN;
END IF;