Re: Disabling Triggers

From: "Mark Borins" <mark(dot)borins(at)rigadev(dot)com>
To: "'Franco Bruno Borghesi'" <fborghesi(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Disabling Triggers
Date: 2005-05-11 15:34:19
Message-ID: 111582565902@smtp-2.vancouver.ipapp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you for the response.

While the TIMESTAMP solution is a good idea.
I was wondering if anyone knew of a SQL like instruction that could be
called.

Like:
UPDATE table SET.... WHERE.... NO TRIGGERS

Or something like that, however, I realize I may just be dreaming.

Mark

________________________________________
From: Franco Bruno Borghesi [mailto:fborghesi(at)gmail(dot)com]
Sent: May 11, 2005 11:24 AM
To: Mark Borins
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Disabling Triggers

You could add a TIMESTAMP field on the three tables (lets call it
last_change), and modify your triggers to update this value every time a row
is updated.

Then your trigger should update the boolean fields with the boolean value of
the row with the max(last_change) in the three tables, only if the row of
the table the trigger is being fired for is less than this max(last_change)
value.

Hope this is understandable :)

Of course you could remove the boolean value from the three tables, create
another table with the boolean value, and forget about the triggers. But I'm
sure you have already though that.

Hope it helps.
2005/5/11, Mark Borins <mark(dot)borins(at)rigadev(dot)com>:
I am creating a system where I have a trigger on three different tables. 
There is a particular Boolean field in each of these tables that when it is
set in table it should be set the same in the other two.
 
So I figured I could put a trigger on each table that when the Boolean field
was updated it would go and update the other 2.
 
However, I am concerned about cascading trigger calls.
 
Does anyone know if it is possible to run an update statement on a table and
for only that statement disable the trigger on the table?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Himanshu Baweja 2005-05-11 15:36:25 how to calculate checkpoint_segments
Previous Message Franco Bruno Borghesi 2005-05-11 15:23:43 Re: Disabling Triggers