aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/sql/xml.sql
diff options
context:
space:
mode:
authorDaniel Gustafsson <dgustafsson@postgresql.org>2023-11-06 09:38:29 +0100
committerDaniel Gustafsson <dgustafsson@postgresql.org>2023-11-06 09:38:29 +0100
commit526fe0d79914b2dfcfd79effd1ab26ff62469248 (patch)
tree7d25dbd45a49eeba488ae7d1f57520babda7e336 /src/test/regress/sql/xml.sql
parent7b5275eec3a50d55f5750357b8a223cf5f0bb59f (diff)
downloadpostgresql-526fe0d79914b2dfcfd79effd1ab26ff62469248.tar.gz
postgresql-526fe0d79914b2dfcfd79effd1ab26ff62469248.zip
Add XMLText function (SQL/XML X038)
This function implements the standard XMLTest function, which converts text into xml text nodes. It uses the libxml2 function xmlEncodeSpecialChars to escape predefined entities (&"<>), so that those do not cause any conflict when concatenating the text node output with existing xml documents. This also adds a note in features.sgml about not supporting XML(SEQUENCE). The SQL specification defines a RETURNING clause to a set of XML functions, where RETURNING CONTENT or RETURNING SEQUENCE can be defined. Since PostgreSQL doesn't support XML(SEQUENCE) all of these functions operate with an implicit RETURNING CONTENT. Author: Jim Jones <jim.jones@uni-muenster.de> Reviewed-by: Vik Fearing <vik@postgresfriends.org> Discussion: https://postgr.es/m/86617a66-ec95-581f-8d54-08059cca8885@uni-muenster.de
Diffstat (limited to 'src/test/regress/sql/xml.sql')
-rw-r--r--src/test/regress/sql/xml.sql7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/regress/sql/xml.sql b/src/test/regress/sql/xml.sql
index a591eea2e5d..bd4a4e7acdf 100644
--- a/src/test/regress/sql/xml.sql
+++ b/src/test/regress/sql/xml.sql
@@ -660,3 +660,10 @@ SELECT * FROM XMLTABLE('*' PASSING '<e>pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n
\x
SELECT * FROM XMLTABLE('.' PASSING XMLELEMENT(NAME a) columns a varchar(20) PATH '"<foo/>"', b xml PATH '"<foo/>"');
+
+SELECT xmltext(NULL);
+SELECT xmltext('');
+SELECT xmltext(' ');
+SELECT xmltext('foo `$_-+?=*^%!|/\()[]{}');
+SELECT xmltext('foo & <"bar">');
+SELECT xmltext('x'|| '<P>73</P>'::xml || .42 || true || 'j'::char); \ No newline at end of file