Disable triggers per transaction 8.2.3

From: Henrik <henke(at)mac(dot)se>
To: pgsql-general(at)postgresql(dot)org
Subject: Disable triggers per transaction 8.2.3
Date: 2007-10-10 16:02:51
Message-ID: 39A7EAF5-0326-4ADC-8CC2-9589A05786AC@mac.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello list,

I wonder if it is possible to disable triggers for a single transaction.
I know I can disable triggers per table but then I need to disable
all triggers in all recursive tables before doing by query.

Can I do:
BEGIN TRANSACTION;
DISABLE TRIGGERS;
DELETE FROM tbl_foo WHERE ID > 5;
ENABLE TRIGGERS;
COMMIT;

Or do I have to do:
BEGIN TRANSACTION;
ALTER TABLE tbl_foo DISABLE TRIGGERS ALL;
ALTER TABLE tbl_foo_bar DISABLE TRIGGERS ALL;

DELETE FROM tbl_foo WHERE ID > 5;

ALTER TABLE tbl_foo ENABLE TRIGGERS ALL;
ALTER TABLE tbl_foo_bar ENABLE TRIGGERS ALL;

COMMIT;

Or is it even possible? I only want my triggers to be disabled for
the transaction and not the global database.

Thanks,
Henke

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2007-10-10 16:05:43 Re: SLEEP in posgresql
Previous Message Ian Barber 2007-10-10 16:02:36 Re: disjoint union types