Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 350410b

Browse filesBrowse files
committed
Add missing quote_identifier calls for CREATE TRIGGER ... REFERENCING.
Mixed-case names for transition tables weren't dumped correctly. Oversight in commit 8c48375, per bug #15440 from Karl Czajkowski. In passing, I couldn't resist a bit of code beautification. Back-patch to v10 where this was introduced. Discussion: https://postgr.es/m/15440-02d1468e94d63d76@postgresql.org
1 parent 197e4af commit 350410b
Copy full SHA for 350410b

File tree

Expand file treeCollapse file tree

1 file changed

+6
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-4
lines changed

‎src/backend/utils/adt/ruleutils.c

Copy file name to clipboardExpand all lines: src/backend/utils/adt/ruleutils.c
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -954,22 +954,24 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
954954
value = fastgetattr(ht_trig, Anum_pg_trigger_tgoldtable,
955955
tgrel->rd_att, &isnull);
956956
if (!isnull)
957-
tgoldtable = NameStr(*((NameData *) DatumGetPointer(value)));
957+
tgoldtable = NameStr(*DatumGetName(value));
958958
else
959959
tgoldtable = NULL;
960960
value = fastgetattr(ht_trig, Anum_pg_trigger_tgnewtable,
961961
tgrel->rd_att, &isnull);
962962
if (!isnull)
963-
tgnewtable = NameStr(*((NameData *) DatumGetPointer(value)));
963+
tgnewtable = NameStr(*DatumGetName(value));
964964
else
965965
tgnewtable = NULL;
966966
if (tgoldtable != NULL || tgnewtable != NULL)
967967
{
968968
appendStringInfoString(&buf, "REFERENCING ");
969969
if (tgoldtable != NULL)
970-
appendStringInfo(&buf, "OLD TABLE AS %s ", tgoldtable);
970+
appendStringInfo(&buf, "OLD TABLE AS %s ",
971+
quote_identifier(tgoldtable));
971972
if (tgnewtable != NULL)
972-
appendStringInfo(&buf, "NEW TABLE AS %s ", tgnewtable);
973+
appendStringInfo(&buf, "NEW TABLE AS %s ",
974+
quote_identifier(tgnewtable));
973975
}
974976

975977
if (TRIGGER_FOR_ROW(trigrec->tgtype))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.