Re: Trigger Firing Order

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
Cc: PostgreSQL General Discussion Forum <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trigger Firing Order
Date: 2013-12-11 04:31:21
Message-ID: 3178.1386736281@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com> writes:
> Is it possible for me to define the order in which triggers will be fired?

Sure: choose their names so that their alphabetical ordering is the
firing order you want. But I see you knew that.

> But with certain packaged products who create their own triggers, I won't
> have control over this.

I don't have a lot of sympathy for that argument. If the product is
capable of creating Postgres-compatible triggers at all, it should be
aware that the name is a significant property, and hence provide some
mechanism for selecting a name. Even if it somehow forgot about the
firing-order property, you can't seriously claim that it's our problem
to cater for combinations of client-side code that each think they can
choose trigger names in a vacuum. What if they choose the same name?

> Also, this could be an issue for me if I write
> business logic in triggers.

This statement lacks content. What problem do you foresee, and what
other ordering rule would you like that doesn't work about as well
as the name rule?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dev Kumkar 2013-12-11 06:31:51 Case sensitivity
Previous Message David Johnston 2013-12-11 04:26:01 Re: Trigger Firing Order