From: | "Ian Harding" <iharding(at)destinydata(dot)com> |
---|---|
To: | "Tomi NA" <hefest(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Disability the trigger |
Date: | 2006-03-20 19:50:08 |
Message-ID: | 725602300603201150h214dc550kba38048eb1edceb8@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 3/16/06, Tomi NA <hefest(at)gmail(dot)com> wrote:
>
>
> On 3/13/06, Claudio Tognolo <claudio(dot)tognolo(at)gmail(dot)com> wrote:
> >
> > I can disable the Trigger?
> >
>
> I'd like to know how this could be done, as well. What I really need is a
> hold-off-all-triggers-untill-I-tell-you-to command, but
> hey, making a trigger just not fire and vice versa would also be nice. :)
>
> Tomislav
>
You can mark triggers as DEFERRABLE and optionally INITIALLY DEFERRED
which will make them hold off on firing until the end of the
transaction, or you can actually turn off triggers with something like
this.
UPDATE "pg_class" SET "reltriggers" = 0 WHERE "relname" = 'tablename';
and turn them back on like so
UPDATE pg_class SET reltriggers = (SELECT count(*) FROM pg_trigger where
pg_class.oid = tgrelid) WHERE relname = 'tablename';
Of course, all that is best done inside an explicit transaction.
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2006-03-20 20:11:54 | Re: Licensing of .DLL files |
Previous Message | Alex bahdushka | 2006-03-20 17:54:46 | Re: PANIC: heap_update_redo: no block |