Re: sql_drop Event Trigger

From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sql_drop Event Trigger
Date: 2013-02-06 13:44:01
Message-ID: m2r4ktlfq6.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> Hmm, quoth
> http://www.postgresql.org/message-id/23345.1358476518@sss.pgh.pa.us :
>
>> I'd really like to get to a point where we can
>> define things as happening like this:
>>
>> * collect information needed to interpret the DDL command
>> (lookup and lock objects, etc)
>> * fire "before" event triggers, if any (and if so, recheck info)
>> * do the command
>> * fire "after" event triggers, if any
>
> Note that in the snippet I posted above objects have already been looked
> up and locked (first phase above).

Ok, I like what you did, but what you did is reinstall the "sql_drop"
event and is not complete, as you mention we have some hard problems to
solve there.

> But I don't think "code structure convenience" is the only reason to do
> things this way instead of postponing firing the trigger until the end.
> I think complete support for drop event triggers really needs to have
> the objects to be dropped still in catalogs, so that they can be looked
> up; for instance, user code might want to check the names of the
> columns and take particular actions if particular names or particular
> types are present. That doesn't seem an easy thing to do if all you get
> is pg_dropped_objects(), because how do you know which columns belong to
> which tables?

Agreed.

In terms of Robert's reviewing, though, I think you're talking about
another patch entirely, that will get worked on in the 9.4 cycle.

And in my terms, doing all that work now is useless anyway because we
are not exposing any object specific information that allow the user to
do any actual catalog lookup anyway, yet.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-02-06 14:24:02 Re: sql_drop Event Trigger
Previous Message Andrew Dunstan 2013-02-06 13:42:50 Re: [HACKERS] Facing authentication error on postgres 9.2 -> dblink functions