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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to