aboutsummaryrefslogtreecommitdiff
path: root/doc/src
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 /doc/src
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 'doc/src')
-rw-r--r--doc/src/sgml/features.sgml9
-rw-r--r--doc/src/sgml/func.sgml30
2 files changed, 39 insertions, 0 deletions
diff --git a/doc/src/sgml/features.sgml b/doc/src/sgml/features.sgml
index 575afa34760..966fd398827 100644
--- a/doc/src/sgml/features.sgml
+++ b/doc/src/sgml/features.sgml
@@ -199,6 +199,15 @@
standard.
</para>
</listitem>
+
+ <listitem>
+ <para>
+ <productname>PostgreSQL</productname> does not support the
+ <literal>RETURNING CONTENT</literal> or <literal>RETURNING SEQUENCE</literal>
+ clauses, functions which are defined to have these in the specification
+ are implicitly returning content.
+ </para>
+ </listitem>
</itemizedlist>
</para>
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index a6fcac0824a..d963f0a0a00 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -14180,6 +14180,36 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
documents for processing in client applications.
</para>
+ <sect3 id="functions-producing-xml-xmltext">
+ <title><literal>xmltext</literal></title>
+
+ <indexterm>
+ <primary>xmltext</primary>
+ </indexterm>
+
+<synopsis>
+<function>xmltext</function> ( <type>text</type> ) <returnvalue>xml</returnvalue>
+</synopsis>
+
+ <para>
+ The function <function>xmltext</function> returns an XML value with a single
+ text node containing the input argument as its content. Predefined entities
+ like ampersand (<literal><![CDATA[&]]></literal>), left and right angle brackets
+ (<literal><![CDATA[< >]]></literal>), and quotation marks (<literal><![CDATA[""]]></literal>)
+ are escaped.
+ </para>
+
+ <para>
+ Example:
+<screen><![CDATA[
+SELECT xmltext('< foo & bar >');
+ xmltext
+-------------------------
+ &lt; foo &amp; bar &gt;
+]]></screen>
+ </para>
+ </sect3>
+
<sect3 id="functions-producing-xml-xmlcomment">
<title><literal>xmlcomment</literal></title>