I have a table with several triggers. One AFTER UPDATE trigger deletes a record if a field named "result" contains -55. A second AFTER UPDATE trigger writes data from the table into a second table that stores a history of the first table, since the first table's records are deleted after they are used. The customer has asked that the first trigger be changed so that an update of the results field to -55 results in a new record being added to the history table, and also the record from the main table gets deleted.
Does the order in which those triggers fire matter? Does PostgreSQL guarantee that both triggers will operate on the original data? A quick test on a copy of the production database showed that the history table got the data from the main table after I set the result to -55, and then the record was deleted from the main table. This could be because PostgreSQL has the guarantee I want, or just because the history trigger fired before the delete trigger. Do I need to change anything?
pgsql-novice by date
|Next:||From: Jean-Yves F. Barbier||Date: 2012-01-27 17:16:22|
|Subject: Re: Order of update triggers|
|Previous:||From: Brent Dombrowski||Date: 2012-01-26 21:42:54|
|Subject: Re: Total Newbie: Trouble installing postgresSQL on OS X Snow Leopard|