This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the
currentversion, or one of the other supported versions listed above instead.
9.28. Event Trigger FunctionsCurrently PostgreSQL provides one built-in event trigger helper function, pg_event_trigger_dropped_objects
.
pg_event_trigger_dropped_objects
returns a list of all object dropped by the command in whose sql_drop event it is called. If called in any other context, pg_event_trigger_dropped_objects
raises an error. pg_event_trigger_dropped_objects
returns the following columns:
The pg_event_trigger_dropped_objects
function can be used in an event trigger like this:
CREATE FUNCTION test_event_trigger_for_drops() RETURNS event_trigger LANGUAGE plpgsql AS $$ DECLARE obj record; BEGIN FOR obj IN SELECT * FROM pg_event_trigger_dropped_objects() LOOP RAISE NOTICE '% dropped object: % %.% %', tg_tag, obj.object_type, obj.schema_name, obj.object_name, obj.object_identity; END LOOP; END $$; CREATE EVENT TRIGGER test_event_trigger_for_drops ON sql_drop EXECUTE PROCEDURE test_event_trigger_for_drops();
For more information about event triggers, see Chapter 37.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4