Re: Disable Trigger

From: CoL <col(at)mportal(dot)hu>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Disable Trigger
Date: 2004-03-23 21:37:20
Message-ID: c3qaha$4oe$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

hi,

Charles Haron wrote, On 3/23/2004 21:48:

> Is there a way to temporarily disable a trigger without dropping and
> re-adding it?

if you ever use dump:
pg_dump --disable-triggers ...

off:
UPDATE pg_catalog.pg_class SET reltriggers = 0 WHERE oid =
'tablename'::pg_catalog.regclass;

on:
UPDATE pg_catalog.pg_class SET reltriggers = (SELECT pg_catalog.count(*)
FROM pg_catalog.pg_trigger where pg_class.oid = tgrelid) WHERE oid =
'tablename'::pg_catalog.regclass;

C.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Bruce Momjian 2004-03-23 21:38:26 Re: Disable Trigger
Previous Message Charles Haron 2004-03-23 20:48:15 Disable Trigger