Re: deferrable triggers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: deferrable triggers
Date
Msg-id 20865.1324427175@sss.pgh.pa.us
Whole thread Raw
In response to Re: deferrable triggers  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: deferrable triggers  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Tom Lane <tgl@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


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: deferrable triggers
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Fix ScalarArrayOpExpr estimation for GIN indexes