Re: PostgreSQL trigger execution order

From: Sebastian Ritter <sebastian(at)campbell-lange(dot)net>
To: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org, software(at)campbell-lange(dot)net
Subject: Re: PostgreSQL trigger execution order
Date: 2010-07-06 10:05:24
Message-ID: 20100706100524.GA1254@campbell-lange.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andre Lopes 2010-07-06 10:28:56 Rules in views, how to?
Previous Message Arnaud Lesauvage 2010-07-06 10:02:30 'default nextval()' loses schema-qualification in dump ?