aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/ruleutils.c3
-rw-r--r--src/test/regress/expected/xml.out10
-rw-r--r--src/test/regress/expected/xml_1.out8
-rw-r--r--src/test/regress/expected/xml_2.out10
-rw-r--r--src/test/regress/sql/xml.sql8
5 files changed, 26 insertions, 13 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index ea5d8683364..c725e80ed03 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -11621,7 +11621,8 @@ get_xmltable(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
{
diff --git a/src/test/regress/expected/xml.out b/src/test/regress/expected/xml.out
index 361a6f9b27c..bd548f2bc5b 100644
--- a/src/test/regress/expected/xml.out
+++ b/src/test/regress/expected/xml.out
@@ -1379,16 +1379,20 @@ SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS zz),
10
(1 row)
-CREATE VIEW xmltableview2 AS SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS zz),
- '/zz:rows/zz:row'
+CREATE VIEW xmltableview2 AS SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS "Zz"),
+ '/Zz:rows/Zz:row'
PASSING '<rows xmlns="http://x.y"><row><a>10</a></row></rows>'
- COLUMNS a int PATH 'zz:a');
+ COLUMNS a int PATH 'Zz:a');
SELECT * FROM xmltableview2;
a
----
10
(1 row)
+\sv xmltableview2
+CREATE OR REPLACE VIEW public.xmltableview2 AS
+ SELECT a
+ FROM XMLTABLE(XMLNAMESPACES ('http://x.y'::text AS "Zz"), ('/Zz:rows/Zz:row'::text) PASSING ('<rows xmlns="http://x.y"><row><a>10</a></row></rows>'::xml) COLUMNS a integer PATH ('Zz:a'::text))
SELECT * FROM XMLTABLE(XMLNAMESPACES(DEFAULT 'http://x.y'),
'/rows/row'
PASSING '<rows xmlns="http://x.y"><row><a>10</a></row></rows>'
diff --git a/src/test/regress/expected/xml_1.out b/src/test/regress/expected/xml_1.out
index d26e10441e8..5e48a67b8e2 100644
--- a/src/test/regress/expected/xml_1.out
+++ b/src/test/regress/expected/xml_1.out
@@ -1046,10 +1046,10 @@ ERROR: unsupported XML feature
LINE 3: PASSING '<rows xmlns="http://x.y"><row...
^
DETAIL: This functionality requires the server to be built with libxml support.
-CREATE VIEW xmltableview2 AS SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS zz),
- '/zz:rows/zz:row'
+CREATE VIEW xmltableview2 AS SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS "Zz"),
+ '/Zz:rows/Zz:row'
PASSING '<rows xmlns="http://x.y"><row><a>10</a></row></rows>'
- COLUMNS a int PATH 'zz:a');
+ COLUMNS a int PATH 'Zz:a');
ERROR: unsupported XML feature
LINE 3: PASSING '<rows xmlns="http://x.y"><row...
^
@@ -1058,6 +1058,8 @@ SELECT * FROM xmltableview2;
ERROR: relation "xmltableview2" does not exist
LINE 1: SELECT * FROM xmltableview2;
^
+\sv xmltableview2
+ERROR: relation "xmltableview2" does not exist
SELECT * FROM XMLTABLE(XMLNAMESPACES(DEFAULT 'http://x.y'),
'/rows/row'
PASSING '<rows xmlns="http://x.y"><row><a>10</a></row></rows>'
diff --git a/src/test/regress/expected/xml_2.out b/src/test/regress/expected/xml_2.out
index 73c2851d3f5..d7a18b972c9 100644
--- a/src/test/regress/expected/xml_2.out
+++ b/src/test/regress/expected/xml_2.out
@@ -1365,16 +1365,20 @@ SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS zz),
10
(1 row)
-CREATE VIEW xmltableview2 AS SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS zz),
- '/zz:rows/zz:row'
+CREATE VIEW xmltableview2 AS SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS "Zz"),
+ '/Zz:rows/Zz:row'
PASSING '<rows xmlns="http://x.y"><row><a>10</a></row></rows>'
- COLUMNS a int PATH 'zz:a');
+ COLUMNS a int PATH 'Zz:a');
SELECT * FROM xmltableview2;
a
----
10
(1 row)
+\sv xmltableview2
+CREATE OR REPLACE VIEW public.xmltableview2 AS
+ SELECT a
+ FROM XMLTABLE(XMLNAMESPACES ('http://x.y'::text AS "Zz"), ('/Zz:rows/Zz:row'::text) PASSING ('<rows xmlns="http://x.y"><row><a>10</a></row></rows>'::xml) COLUMNS a integer PATH ('Zz:a'::text))
SELECT * FROM XMLTABLE(XMLNAMESPACES(DEFAULT 'http://x.y'),
'/rows/row'
PASSING '<rows xmlns="http://x.y"><row><a>10</a></row></rows>'
diff --git a/src/test/regress/sql/xml.sql b/src/test/regress/sql/xml.sql
index f752ecb1421..bac0388ac11 100644
--- a/src/test/regress/sql/xml.sql
+++ b/src/test/regress/sql/xml.sql
@@ -439,13 +439,15 @@ SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS zz),
PASSING '<rows xmlns="http://x.y"><row><a>10</a></row></rows>'
COLUMNS a int PATH 'zz:a');
-CREATE VIEW xmltableview2 AS SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS zz),
- '/zz:rows/zz:row'
+CREATE VIEW xmltableview2 AS SELECT * FROM XMLTABLE(XMLNAMESPACES('http://x.y' AS "Zz"),
+ '/Zz:rows/Zz:row'
PASSING '<rows xmlns="http://x.y"><row><a>10</a></row></rows>'
- COLUMNS a int PATH 'zz:a');
+ COLUMNS a int PATH 'Zz:a');
SELECT * FROM xmltableview2;
+\sv xmltableview2
+
SELECT * FROM XMLTABLE(XMLNAMESPACES(DEFAULT 'http://x.y'),
'/rows/row'
PASSING '<rows xmlns="http://x.y"><row><a>10</a></row></rows>'