Re: Command Triggers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Command Triggers
Date
Msg-id 1699.1327087670@sss.pgh.pa.us
Whole thread Raw
In response to Re: Command Triggers  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Command Triggers  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Hmm, OK.  But what happens if the user doesn't specify a schema name explicitly?

For the creation case, RangeVarGetCreationNamespace should handle that.
The code Dimitri quoted is wrong, but not that hard to fix.

Unfortunately, the code he quoted for the ALTER case is also wrong,
and harder to fix.  Until you've done the lookup you don't know which
schema the referenced object is in.  And I don't care for the idea of
doing the lookup twice, as (a) it'll be slower and (b) there are race
cases where it will give the wrong answer, ie return an object other
than the one the ALTER eventually acts on.

Really I think there is not any single point where you can put the
command-trigger hook and be done.  In almost every case, the right
place is going to be buried somewhere within the execution of the
command.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: JSON for PG 9.2
Next
From: Dimitri Fontaine
Date:
Subject: Re: Command Triggers