Re: PostgreSQL trigger execution order - Mailing list pgsql-general

From Sebastian Ritter
Subject Re: PostgreSQL trigger execution order
Date
Msg-id 20100706100524.GA1254@campbell-lange.net
Whole thread Raw
In response to Re: PostgreSQL trigger execution order  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
Responses Re: PostgreSQL trigger execution order  (Sebastian Ritter <sebastian@campbell-lange.net>)
List pgsql-general
Hi Alban,

Thanks again for your response.

On Tue, Jul 06, 2010 at 11:57:14AM +0200, Alban Hertroys wrote:
> On 6 Jul 2010, at 11:33, Sebastian Ritter wrote:
>
> > In what order will the triggers be executed?
> >
> > Will it be:
> >
> > INSERT row
> > INVOKE TRIGGER A (First call)
> > INVOKE TRIGGER B (First call) -> INSERT row
> >                                 INVOKE TRIGGER A (Second call)
> >                                 INVOKE TRIGGER B (let say no new insert)
> >                                 INVOKE TRIGGER C (Second call)
> >                                 INVOKE TRIGGER D (Second call)
> > INVOKE TRIGGER C (First call)
> > INVOKE TRIGGER D (First call)
> >
> > Or will it be:
> >
> > INVOKE TRIGGER A (First call)
> > INVOKE TRIGGER B (First call) -> INSERT row and wait...
>
> Wait for what exactly? You seem to expect some kind of external event here.

'wait...' for the first invocation of trigger C and D to finish before
starting the second round of invocations A-D.

>
> > INVOKE TRIGGER C (First call)
> > INVOKE TRIGGER D (First call)
> >
> > INVOKE TRIGGER A (Second call)
> > INVOKE TRIGGER B (let say no new insert)
> > INVOKE TRIGGER C (Second call)
> > INVOKE TRIGGER D (Second call)
> >

As you suggested in your response, I think the first scenario is
happening.

Regards,
Seb

pgsql-general by date:

Previous
From: Arnaud Lesauvage
Date:
Subject: 'default nextval()' loses schema-qualification in dump ?
Next
From: "Davor J."
Date:
Subject: Re: psql \dp equivalent or similar query?