Re: deferrable triggers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: deferrable triggers
Date: 2011-12-21 00:26:15
Message-ID: 20865.1324427175@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-12-21 01:03:47 Re: [PATCH] Fix ScalarArrayOpExpr estimation for GIN indexes
Previous Message Kevin Grittner 2011-12-20 22:29:00 Re: deferrable triggers