foreign key, on delete cascade...

From: Mathieu Arnold <mat(at)mat(dot)cc>
To: pgsql-sql(at)postgresql(dot)org
Subject: foreign key, on delete cascade...
Date: 2002-10-08 13:47:52
Message-ID: 678757221.1034092072@andromede.reaumur.absolight.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi

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.

--
Mathieu Arnold

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ron Johnson 2002-10-08 13:50:52 Re: [GENERAL] Large databases, performance
Previous Message Jan Wieck 2002-10-08 13:32:50 Re: Pinning a table into memory