disabling triggers temporaly

Hi! does it exists any way to make that a trigger be disabled only for
one insert and for other inserts not?

I have a table, every insert,update or delete on it activates a trigger
that do some tasks, but i wish that when i call special
insert/update/delete on that table the trigger doesn't starts...

The only way i think to do that is to start a transaction, delete the
trigger, do the insert on the table, create the trigger again an commit
the transaction..., and another is to make the trigger to check some
value, and if that value is 1 the trigger works, if it is 0 the trigger
doesn't, but i wish to know if it is a better way.

Thank you.




---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org
Mario Medina Nussbaum [ Fr, 02 Juni 2006 06:54 ] [ ID #1341466 ]

Re: disabling triggers temporaly

On Friday 02 June 2006 00:54, Mario Medina wrote:
> Hi! does it exists any way to make that a trigger be disabled only for
> one insert and for other inserts not?
>
> I have a table, every insert,update or delete on it activates a trigger
> that do some tasks, but i wish that when i call special
> insert/update/delete on that table the trigger doesn't starts...
>
> The only way i think to do that is to start a transaction, delete the
> trigger, do the insert on the table, create the trigger again an commit
> the transaction..., and another is to make the trigger to check some
> value, and if that value is 1 the trigger works, if it is 0 the trigger
> doesn't, but i wish to know if it is a better way.
>

You can do this with alter table... see
http://www.postgresql.org/docs/8.1/interactive/sql-altertabl e.html

--
Robert Treat
Build A Brighter Lamp :: http://www.brighterlamp.org

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
Robert Treat [ So, 04 Juni 2006 16:15 ] [ ID #1341467 ]
Datenbanken » gmane.comp.db.postgresql.php » disabling triggers temporaly

Vorheriges Thema: Accessing output parameters from my program?
Nächstes Thema: php|works / db|works call for papers ends June 5th