Stupid question about triggers - Mailing list pgsql-admin

From Mauri Sahlberg
Subject Stupid question about triggers
Date
Msg-id 43218C15.1070704@claymountain.com
Whole thread Raw
Responses Re: Stupid question about triggers
List pgsql-admin
Hi,

I have found myself in a situation where I need to quickly delete rows
from a production database. Unfortunately table for the rows to be
deleted have triggers which results massive chain of update operations
on other tables. I do not wish those to happen as I'm about to delete
concerned rows from the other tables as well. (7.4.7)

Would

begin work
select reltriggers from pg_class where relname='foo' for update;
update pg_class set reltriggers=0 where relname='foo';
delete from foo where ...
update pg_class set reltriggers=original value where relname='foo';
commit

work?

Or
begin work
select reltriggers from pg_class where relname='foo';
update pg_class set reltriggers=0 where relname='foo';
delete from foo where ...
update pg_class set reltriggers=original value where relname='foo';
commit

as I'm quite sure the number of triggers for that table will not change
while I'm doing the deletion.

Thank you.


pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Stats turned on but not being updated
Next
From: Dilipan Sebastiampillai
Date:
Subject: could not locate a valid checkpoint record