"Kevin Grittner" <kevin.gritt...@wicourts.gov> writes:
> Tom Lane <t...@sss.pgh.pa.us> wrote:
>> What do you mean by "hand-written DEFERRABLE trigger"?
 
> Ah, I had forgotten that I had to use the CONSTRAINT keyword in the
> trigger definition; the sentence in the docs makes more sense now.
 
> I wrote a plpgsql trigger function and created a deferrable
> initially deferred constraint trigger which referenced it.  Is that
> a reasonable thing to do if you need a commit-time trigger based on
> some particular action against a particular table?  Would it be a
> reasonable way for the person on irc to enforce the business rule
> mentioned above?

Sure.  The reason we decided to document CREATE CONSTRAINT TRIGGER was
exactly that people sometimes need to use it for things besides foreign
keys.  However, it's not a "commit time" trigger exactly -- keep in mind
that SET CONSTRAINTS can override the trigger's own timing
specification.

                        regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to