From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | " SZŰCS =?iso-8859-2?q?=20G=E1bor?=" <surrano(at)mailbox(dot)hu>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Order of triggers - totally lost |
Date: | 2003-08-13 15:55:04 |
Message-ID: | 200308130855.04062.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
G:
> * what is sure about trigger execution order?
> (Cristoph Haller partially answered my question, quoting future plans)
My perspective: multiple triggers of the same type on the same table are a
really bad idea if execution order matters. Any setup like this is
automatically maintenence hell, even when we add some sort of "trigger
priority" feature.
If your table needs multiple BEFORE operations, you should put the operations
into one large procedure with branching logic.
> * are there generic recommendations what kind of things to put in
> before and after triggers?
before triggers: re-formating input and inserting complex defaults before
saving to table; historical archiving of old data; data validation.
after triggers: updating related tables; chronological logging of activity.
> * how about FOR EACH STATEMENT triggers?
> (we only use FOR EACH ROW triggers)
These will not work until 7.4, and then there will be some limitations (which
will hopefully go away in 7.5).
--
Josh Berkus
Aglio Database Solutions
San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | SZŰCS Gábor | 2003-08-13 16:10:11 | Re: Order of triggers - totally lost |
Previous Message | SZŰCS Gábor | 2003-08-13 15:40:26 | Re: Order of triggers - totally lost |