pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Mathieu Arnold <m@mat.cc>
Cc: pgsql-sql@postgresql.org
Subject: Re: foreign key, on delete cascade...
Date: Tue, 8 Oct 2002 08:00:15 -0700 (PDT)
Message-ID: <20021008075918.V90836-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <678757221.1034092072@andromede.reaumur.absolight.net>


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.




view thread (2+ messages)

Message-ID: <20021008075918.V90836-100000@megazone23.bigpanda.com>
Permalink:  ../20021008075918.V90836-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20021008075918.V90836-100000@megazone23.bigpanda.com

 · 

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: sszabo@megazone23.bigpanda.com, m@mat.cc
  Subject: Re: foreign key, on delete cascade...
  In-Reply-To: <20021008075918.V90836-100000@megazone23.bigpanda.com>

* 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