This section concerns limits that are not inherent in the libxml2 library, but apply to the current implementation in PostgreSQL.
D.3.2.1. OnlyBY VALUE
Passing Mechanism Is Supported #
The SQL standard defines two passing mechanisms that apply when passing an XML argument from SQL to an XML function or receiving a result: BY REF
, in which a particular XML value retains its node identity, and BY VALUE
, in which the content of the XML is passed but node identity is not preserved. A mechanism can be specified before a list of parameters, as the default mechanism for all of them, or after any parameter, to override the default.
To illustrate the difference, if x
is an XML value, these two queries in an SQL:2006 environment would produce true and false, respectively:
SELECT XMLQUERY('$a is $b' PASSING BY REFx
AS a,x
AS b NULL ON EMPTY); SELECT XMLQUERY('$a is $b' PASSING BY VALUEx
AS a,x
AS b NULL ON EMPTY);
PostgreSQL will accept BY VALUE
or BY REF
in an XMLEXISTS
or XMLTABLE
construct, but it ignores them. The xml
data type holds a character-string serialized representation, so there is no node identity to preserve, and passing is always effectively BY VALUE
.
The XPath-based functions support passing one parameter to serve as the XPath expression's context item, but do not support passing additional values to be available to the expression as named parameters.
D.3.2.3. NoXML(SEQUENCE)
Type #
The PostgreSQL xml
data type can only hold a value in DOCUMENT
or CONTENT
form. An XQuery/XPath expression context item must be a single XML node or atomic value, but XPath 1.0 further restricts it to be only an XML node, and has no node type allowing CONTENT
. The upshot is that a well-formed DOCUMENT
is the only form of XML value that PostgreSQL can supply as an XPath context item.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4