Home > Archive > PostgreSQL Administration > October 2006 > Rules/Triggers executio order









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Rules/Triggers executio order
Benjamin Krajmalnik

2006-10-25, 8:24 am

I have a partitioned table to which I route data using a trigger.
I am changing it to use a set of rules which executes "INSTEAD" on
insert.
The parent table currently has a trigger.

The system is a live system. I would prefer to not have to suspend the
data flow.
If I create the rules, and given the fact that they execute "INSTEAD" of
the insertion into the parent table, will the trigger still execute.
I will be removing the trigger immediately after the creation of the
rules, but just want to be safe and make sure I get no duplicate
entries.

Thanks in advance.

Jim C. Nasby

2006-10-25, 8:24 am

On Wed, Oct 18, 2006 at 06:42:21PM -0600, Benjamin Krajmalnik wrote:
> I have a partitioned table to which I route data using a trigger.
> I am changing it to use a set of rules which executes "INSTEAD" on
> insert.
> The parent table currently has a trigger.
>
> The system is a live system. I would prefer to not have to suspend the
> data flow.
> If I create the rules, and given the fact that they execute "INSTEAD" of
> the insertion into the parent table, will the trigger still execute.
> I will be removing the trigger immediately after the creation of the
> rules, but just want to be safe and make sure I get no duplicate
> entries.


An INSTEAD OF rule replaces the query that you originally had with the
one re-written by the rule, so no, the triggers shouldn't fire. But you
should test to make sure.
--
Jim Nasby jim@nasby.net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com