@@ -10583,7 +10583,7 @@ SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
10583
10583
</indexterm>
10584
10584
10585
10585
<synopsis>
10586
- <function>XMLEXISTS</function>(<replaceable>text</replaceable> PASSING <optional>BY REF</optional> <replaceable>xml</replaceable> <optional>BY REF</optional>)
10586
+ <function>XMLEXISTS</function>(<replaceable>text</replaceable> PASSING <optional>BY { REF | VALUE } </optional> <replaceable>xml</replaceable> <optional>BY { REF | VALUE } </optional>)
10587
10587
</synopsis>
10588
10588
10589
10589
<para>
@@ -10596,7 +10596,7 @@ SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
10596
10596
<para>
10597
10597
Example:
10598
10598
<screen><![CDATA[
10599
- SELECT xmlexists('//town[text() = ''Toronto'']' PASSING BY REF '<towns><town>Toronto</town><town>Ottawa</town></towns>');
10599
+ SELECT xmlexists('//town[text() = ''Toronto'']' PASSING BY VALUE '<towns><town>Toronto</town><town>Ottawa</town></towns>');
10600
10600
10601
10601
xmlexists
10602
10602
------------
@@ -10606,14 +10606,25 @@ SELECT xmlexists('//town[text() = ''Toronto'']' PASSING BY REF '<towns><town>Tor
10606
10606
</para>
10607
10607
10608
10608
<para>
10609
- The <literal>BY REF</literal> clauses have no effect in
10610
- PostgreSQL, but are allowed for SQL conformance and compatibility
10611
- with other implementations. Per SQL standard, the
10612
- first <literal>BY REF</literal> is required, the second is
10613
- optional. Also note that the SQL standard specifies
10614
- the <function>xmlexists</function> construct to take an XQuery
10615
- expression as first argument, but PostgreSQL currently only
10616
- supports XPath, which is a subset of XQuery.
10609
+ The <literal>BY REF</literal> or <literal>BY VALUE</literal> clauses
10610
+ have no effect in <productname>PostgreSQL<productname>, but are allowed
10611
+ for compatibility with other implementations. Per the <acronym>SQL</acronym>
10612
+ standard, the one that precedes any argument is required, and indicates
10613
+ the default for arguments that follow, and one may follow any argument to
10614
+ override the default.
10615
+ <productname>PostgreSQL</productname> ignores <literal>BY REF</literal>
10616
+ and passes by value always.
10617
+ </para>
10618
+
10619
+ <para>
10620
+ In the <acronym>SQL</acronym> standard, an <function>xmlexists</function>
10621
+ construct evaluates an expression in the XQuery language, allows passing
10622
+ values for named parameters in the expression as well as for the context
10623
+ item, and does not require the passed values to be documents, or even of
10624
+ XML type.
10625
+ In <productname>PostgreSQL</productname>, this construct currently only
10626
+ evaluates an XPath 1.0 expression, and allows passing only one value,
10627
+ which must be an XML document, to be the context item.
10617
10628
</para>
10618
10629
</sect3>
10619
10630
@@ -10820,7 +10831,7 @@ SELECT xpath_exists('/my:a/text()', '<my:a xmlns:my="http://example.com">test</m
10820
10831
10821
10832
<synopsis>
10822
10833
<function>xmltable</function>( <optional>XMLNAMESPACES(<replaceable>namespace uri</replaceable> AS <replaceable>namespace name</replaceable><optional>, ...</optional>), </optional>
10823
- <replaceable>row_expression</replaceable> PASSING <optional>BY REF</optional> <replaceable>document_expression</replaceable> <optional>BY REF</optional>
10834
+ <replaceable>row_expression</replaceable> PASSING <optional>BY { REF | VALUE } </optional> <replaceable>document_expression</replaceable> <optional>BY { REF | VALUE } </optional>
10824
10835
COLUMNS <replaceable>name</replaceable> { <replaceable>type</replaceable> <optional>PATH <replaceable>column_expression</replaceable></optional> <optional>DEFAULT <replaceable>default_expression</replaceable></optional> <optional>NOT NULL | NULL</optional>
10825
10836
| FOR ORDINALITY }
10826
10837
<optional>, ...</optional>
@@ -10850,11 +10861,11 @@ SELECT xpath_exists('/my:a/text()', '<my:a xmlns:my="http://example.com">test</m
10850
10861
<para>
10851
10862
<replaceable>document_expression</replaceable> provides the XML document to
10852
10863
operate on.
10853
- The <literal>BY REF</literal> clauses have no effect in PostgreSQL,
10854
- but are allowed for SQL conformance and compatibility with other
10855
- implementations.
10856
10864
The argument must be a well-formed XML document; fragments/forests
10857
10865
are not accepted.
10866
+ The <literal>BY REF</literal> or <literal>BY VALUE</literal> clauses are
10867
+ accepted, as described for the <function>xmlexists</function> predicate,
10868
+ but ignored; PostgreSQL currently passes XML by value always.
10858
10869
</para>
10859
10870
10860
10871
<para>
0 commit comments