From dc8cd9cd0198ff1d87815e74b101b4c03754f513 Mon Sep 17 00:00:00 2001 From: Dean Rasheed Date: Sun, 12 Jan 2025 13:01:22 +0000 Subject: 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 --- src/backend/utils/adt/ruleutils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/adt/ruleutils.c') diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 993e28a273c..55330047cce 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -10692,7 +10692,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 { -- cgit v1.2.3