From 526fe0d79914b2dfcfd79effd1ab26ff62469248 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Mon, 6 Nov 2023 09:38:29 +0100 Subject: 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 Reviewed-by: Vik Fearing Discussion: https://postgr.es/m/86617a66-ec95-581f-8d54-08059cca8885@uni-muenster.de --- doc/src/sgml/features.sgml | 9 +++++++++ doc/src/sgml/func.sgml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'doc/src') 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. + + + + PostgreSQL does not support the + RETURNING CONTENT or RETURNING SEQUENCE + clauses, functions which are defined to have these in the specification + are implicitly returning content. + + 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. + + <literal>xmltext</literal> + + + xmltext + + + +xmltext ( text ) xml + + + + The function xmltext returns an XML value with a single + text node containing the input argument as its content. Predefined entities + like ampersand (), left and right angle brackets + (]]>), and quotation marks () + are escaped. + + + + Example: +'); + xmltext +------------------------- + < foo & bar > +]]> + + + <literal>xmlcomment</literal> -- cgit v1.2.3