Skip to content

Commit 350410b

Browse 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

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/backend/utils/adt/ruleutils.c

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy