Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 64220476083 for ; Tue, 8 Oct 2002 11:00:15 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id BC4C7475FB5 for ; Tue, 8 Oct 2002 11:00:14 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 0C17CD61D; Tue, 8 Oct 2002 08:00:15 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id D5A475C04; Tue, 8 Oct 2002 08:00:15 -0700 (PDT) Date: Tue, 8 Oct 2002 08:00:15 -0700 (PDT) From: Stephan Szabo To: Mathieu Arnold Cc: Subject: Re: foreign key, on delete cascade... In-Reply-To: <678757221.1034092072@andromede.reaumur.absolight.net> Message-ID: <20021008075918.V90836-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/106 X-Sequence-Number: 9823 On Tue, 8 Oct 2002, Mathieu Arnold wrote: > I found in an old pgsql dump something like : > > UPDATE "pg_class" SET "reltriggers" = 0 WHERE "relname" ~* 'TABLE NAME'; > > inserts.... > > BEGIN TRANSACTION; > CREATE TEMP TABLE "tr" ("tmp_relname" name, "tmp_reltriggers" smallint); > INSERT INTO "tr" SELECT C."relname", count(T."oid") FROM "pg_class" C, > "pg_trigger" T WHERE C."oid" = T."tgrelid" AND C."relname" ~* 'TABLE NAME' > GROUP BY 1; > UPDATE "pg_class" SET "reltriggers" = TMP."tmp_reltriggers" FROM "tr" TMP > WHERE "pg_class"."relname" = TMP."tmp_relname"; > DROP TABLE "tr"; > COMMIT TRANSACTION; > > Which was supposed to disable triggers on this table during the inserts. It > was on 7.0.x I believe, It still work with 7.2.3, but I was wondering if it > was the right way to do. For right now, I believe so as long as you don't want the inserted rows to be checked at all.