Small bug in pg_dump
| От | Tom Lane |
|---|---|
| Тема | Small bug in pg_dump |
| Дата | |
| Msg-id | 7680.984440501@sss.pgh.pa.us обсуждение |
| Ответы |
Re: Small bug in pg_dump
|
| Список | pgsql-hackers |
Hi Philip,
I have not updated from CVS in a few days, but I suspect you haven't
noticed this yet: given a mixed-case table name and a scenario that
requires emitting UPDATE pg_class commands, pg_dump puts out
things like
UPDATE "pg_class" SET "reltriggers" = 0 WHERE "relname" ~* '"Table"';
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"' 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;
Of course those ~* '"Table"' clauses aren't going to work too well; the
identifier should NOT be double-quoted inside the pattern.
Actually, this should not be using ~* in the first place --- why isn't
it just using WHERE relname = 'Table' ??? Seems like it's not cool to
gratuitously reset the trigger counts on other tables that contain Table
as a substring of their names.
And while we're at it, the temp table hasn't been necessary for a
release or three. That whole transaction should be replaced by
UPDATE pg_class SET reltriggers =(SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid)
WHERE relname = 'Table';
regards, tom lane
В списке pgsql-hackers по дате отправления: