Re: [HACKERS] deferrable triggers

2011-12-21 Thread Kevin Grittner
Tom Lane wrote: > However, it's not a "commit time" trigger exactly -- keep in mind > that SET CONSTRAINTS can override the trigger's own timing > specification. Hmm. Is there a way for trigger code to check whether it is running deferred (at transaction commit time) versus immediate? (If no

Re: [HACKERS] deferrable triggers

2011-12-20 Thread Tom Lane
"Kevin Grittner" writes: > Tom Lane 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 de

Re: [HACKERS] deferrable triggers

2011-12-20 Thread Kevin Grittner
Tom Lane wrote: > "Kevin Grittner" writes: >> In a discussion on irc today, someone had a need to confirm that >> a business rule (this table has two rows for every related one >> row in another table) was true at commit time. I innocently >> suggested a deferrable (and deferred) trigger. It wa

Re: [HACKERS] deferrable triggers

2011-12-20 Thread Tom Lane
"Kevin Grittner" writes: > In a discussion on irc today, someone had a need to confirm that a > business rule (this table has two rows for every related one row in > another table) was true at commit time. I innocently suggested a > deferrable (and deferred) trigger. It was pointed out that the

[HACKERS] deferrable triggers

2011-12-20 Thread Kevin Grittner
In a discussion on irc today, someone had a need to confirm that a business rule (this table has two rows for every related one row in another table) was true at commit time. I innocently suggested a deferrable (and deferred) trigger. It was pointed out that the docs: http://www.postgresql.org/

Re: [HACKERS] Deferrable triggers

2003-11-06 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > To -hackers: Is it still safe to send small documentation patches for 7.4 > at this point? Of course. Docs patches are fair game up till release (although I think Peter wants us to minimize edits to the reference pages, because regenerating the man page

Re: [HACKERS] Deferrable triggers

2003-11-06 Thread Stephan Szabo
On Thu, 7 Nov 2003, Grant McLean wrote: > On Fri, 2003-11-07 at 11:31, Stephan Szabo wrote: > > > > On Thu, 7 Nov 2003, Grant McLean wrote: > > > > > So it would seem that if I include the clauses: > > > > > > on delete restrict on update restrict > > > > > > Then the 'deferrable' which fo

Re: [HACKERS] Deferrable triggers

2003-11-06 Thread Grant McLean
On Fri, 2003-11-07 at 11:31, Stephan Szabo wrote: > > On Thu, 7 Nov 2003, Grant McLean wrote: > > > So it would seem that if I include the clauses: > > > > on delete restrict on update restrict > > > > Then the 'deferrable' which follows is only applied to creates and > > not to updates o

Re: [HACKERS] Deferrable triggers

2003-11-06 Thread Stephan Szabo
On Thu, 7 Nov 2003, Grant McLean wrote: > So it would seem that if I include the clauses: > > on delete restrict on update restrict > > Then the 'deferrable' which follows is only applied to creates and > not to updates or deletes. > > Since 'restrict' is the default, the clauses aren't a

[HACKERS] Deferrable triggers

2003-11-06 Thread Grant McLean
Hi Hackers I have noticed an issue with deferrable triggers not always being deferrable. Eg: alter table subsession add constraint fk_subsession_session foreign key (session_id) references session (session_id) deferrable; alter table subsession2 add constraint fk