Stupid question about triggers

From: Mauri Sahlberg <Mauri(dot)Sahlberg(at)claymountain(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Stupid question about triggers
Date: 2005-09-09 13:20:21
Message-ID: 43218C15.1070704@claymountain.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Dilipan Sebastiampillai 2005-09-09 14:17:16 could not locate a valid checkpoint record
Previous Message Tom Lane 2005-09-09 02:52:37 Re: Stats turned on but not being updated