aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorDean Rasheed <dean.a.rasheed@gmail.com>2025-01-12 12:59:40 +0000
committerDean Rasheed <dean.a.rasheed@gmail.com>2025-01-12 12:59:40 +0000
commit7c0379516f367cf6a3709c46b2fed12777468130 (patch)
tree90f56f06a5f0b1c24ed6376e9c934029ed7218a8 /src/backend/utils/adt/ruleutils.c
parent71bb9c4b2a1425877e0ef2a983bb855c6ce7bffc (diff)
downloadpostgresql-7c0379516f367cf6a3709c46b2fed12777468130.tar.gz
postgresql-7c0379516f367cf6a3709c46b2fed12777468130.zip
Fix XMLTABLE() deparsing to quote namespace names if necessary.
When deparsing an XMLTABLE() expression, XML namespace names were not quoted. However, since they are parsed as ColLabel tokens, some names require double quotes to ensure that they are properly interpreted. Fix by using quote_identifier() in the deparsing code. Back-patch to all supported versions. Dean Rasheed, reviewed by Tom Lane. Discussion: https://postgr.es/m/CAEZATCXTpAS%3DncfLNTZ7YS6O5puHeLg_SUYAit%2Bcs7wsrd9Msg%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index bc1fbe97a63..035faf418f0 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -10923,7 +10923,8 @@ get_tablefunc(TableFunc *tf, deparse_context *context, bool showimplicit)
if (ns_node != NULL)
{
get_rule_expr(expr, context, showimplicit);
- appendStringInfo(buf, " AS %s", strVal(ns_node));
+ appendStringInfo(buf, " AS %s",
+ quote_identifier(strVal(ns_node)));
}
else
{