pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mathieu Arnold <mat@mat.cc>
To: pgsql-sql@postgresql.org
Subject: foreign key, on delete cascade...
Date: Tue, 08 Oct 2002 15:47:52 +0200
Message-ID: <678757221.1034092072@andromede.reaumur.absolight.net> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <678757221.1034092072@andromede.reaumur.absolight.net>
Permalink:  ../678757221.1034092072@andromede.reaumur.absolight.net/
Also on:    postgresql.org/message-id/678757221.1034092072@andromede.reaumur.absolight.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mat@mat.cc
  Subject: Re: foreign key, on delete cascade...
  In-Reply-To: <678757221.1034092072@andromede.reaumur.absolight.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox