Robert Haas <robertmh...@gmail.com> writes: > OK, I committed this.
Thanks. Please find attached a rebased patch, v6. I think it's looking more like what you would expect now: COLUMNS=70 git diff --stat postgres/master.. doc/src/sgml/event-trigger.sgml | 196 +++- doc/src/sgml/plpgsql.sgml | 95 +- doc/src/sgml/ref/create_event_trigger.sgml | 20 +- src/backend/catalog/objectaddress.c | 22 +- src/backend/commands/event_trigger.c | 870 ++++++++++++++++- src/backend/commands/trigger.c | 39 + src/backend/commands/typecmds.c | 2 +- src/backend/tcop/utility.c | 385 +++++--- src/backend/utils/cache/evtcache.c | 15 + src/bin/pg_dump/pg_dump.c | 21 +- src/bin/pg_dump/pg_dump.h | 1 + src/bin/psql/describe.c | 9 +- src/include/catalog/objectaddress.h | 21 + src/include/catalog/pg_event_trigger.h | 2 + src/include/commands/event_trigger.h | 47 +- src/include/commands/trigger.h | 1 + src/include/utils/evtcache.h | 6 +- src/pl/plpgsql/src/pl_comp.c | 48 + src/pl/plpgsql/src/pl_exec.c | 57 +- src/pl/plpgsql/src/plpgsql.h | 6 + src/test/regress/expected/event_trigger.out | 53 +- src/test/regress/sql/event_trigger.sql | 51 +- 22 files changed, 1700 insertions(+), 267 deletions(-) >> That completes ALTER and CREATE ObjectID support, I did nothing about >> the DROP case in the attached. The way I intend to solve that problem is >> using get_object_address() and do an extra lookup from within the Event >> Trigger code path. > > An extra lookup that occurs always, or only when event triggers are in > use? A re-resolution of the name, or some other kind of lookup? Only when event triggers are in use, and when the object is known to exists in the catalogs (ddl_command_start for a DROP operation, or ddl_command_end for a CREATE or ALTER operation). And it's only a name resolution using the catcache when it exists, or a catalog index scan when we have to. The key we have is the OID. The OID is filled in from utility.c in all CREATE and ALTER operations that we are interested into, and in the case of a DROP operation we do either a RangeVarGetRelid for relations or get_object_address() for the other object kinds. Given the OID, we use the ObjectProperty[] structure to know which cache or catalog to scan in order to get the name and namespace of the object. Regards, -- Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
event_trigger_infos.6.patch.gz
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers