Re: sql_drop Event Triggerg - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: sql_drop Event Triggerg
Date
Msg-id 20130327050633.GE3881@alvh.no-ip.org
Whole thread Raw
In response to Re: sql_drop Event Triggerg  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: sql_drop Event Triggerg  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Alvaro Herrera escribió:

> However, I think previous discussions have conflated many different
> things, and we've been slowly fixing them one by one; so perhaps at this
> point it does make sense to have a new object-drop event.  Let's discuss
> it -- we would define it as taking place just before ddl_command_end,
> and firing any time a command (with matching tag?) has called
> performDeletion or performMultipleDeletions.  Does that sound okay?

Here's another version of this patch.  I hope this is really final now
... but then, that's what I thought of the previous two versions, too.

I have re-instated event sql_drop, which takes place just before
ddl_command_end, and is called a single time per command (not once per
object dropped, as the old definition would have had it).  Within a
function running in that event, you can call
pg_event_trigger_dropped_object(); that will give you a list of all
objects that have been dropped.  Since the deletion command has already
been run, the objects are not in catalogs anymore.  There are no magic
TG_* variables about objects deleted.  I'm a bit unhappy about having to
add calls to EventTriggerSQLDrop() just before each call to
EventTriggerDDLCommandEnd(), but I didn't see any way to make this less
duplicative.

Docs and regression tests have been minimally fixed.

The new event is called sql_drop, note.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Atri Sharma
Date:
Subject: Re: GSoC project : K-medoids clustering in Madlib
Next
From: Tom Lane
Date:
Subject: Re: GSoC project : K-medoids clustering in Madlib