pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Disable Trigger
3+ messages / 3 participants
[nested] [flat]

* Disable Trigger
@ 2004-03-23 20:48 Charles Haron <charles.haron@cognitive.com>
  2004-03-23 21:37 ` Re: Disable Trigger CoL <col@mportal.hu>
  2004-03-23 21:38 ` Re: Disable Trigger Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 2 replies; 3+ messages in thread

From: Charles Haron @ 2004-03-23 20:48 UTC (permalink / raw)
  To: pgsql-admin

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

Thanks,
Chuck




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Disable Trigger
  2004-03-23 20:48 Disable Trigger Charles Haron <charles.haron@cognitive.com>
@ 2004-03-23 21:37 ` CoL <col@mportal.hu>
  1 sibling, 0 replies; 3+ messages in thread

From: CoL @ 2004-03-23 21:37 UTC (permalink / raw)
  To: 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.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Disable Trigger
  2004-03-23 20:48 Disable Trigger Charles Haron <charles.haron@cognitive.com>
@ 2004-03-23 21:38 ` Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2004-03-23 21:38 UTC (permalink / raw)
  To: Charles Haron <charles.haron@cognitive.com>; +Cc: pgsql-admin

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

You can update the sytem tables by setting the number of triggers to
zero on the table. See the PostgreSQL cookbook for examples.  We have a
TODO item to get this implemented cleanly.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-03-23 21:38 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-03-23 20:48 Disable Trigger Charles Haron <charles.haron@cognitive.com>
2004-03-23 21:37 ` CoL <col@mportal.hu>
2004-03-23 21:38 ` Bruce Momjian <pgman@candle.pha.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox