Re: foreign key, on delete cascade...

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Mathieu Arnold <m(at)mat(dot)cc>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: foreign key, on delete cascade...
Date: 2002-10-08 15:00:15
Message-ID: 20021008075918.V90836-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Charles Hauser 2002-10-08 15:04:19 Re: Problems Formulating a SELECT
Previous Message Shridhar Daithankar 2002-10-08 14:41:47 Re: [GENERAL] Large databases, performance