Skip to content

Commit 73c1748

Browse files
committed
Fix XMLTABLE synopsis, add XMLNAMESPACES example
Add a missing comma in the synopsis after the XMLNAMESPACES clause. Also, add an example illustrating the use of that clause. Author: Arjen Nienhuis and Pavel Stěhule
1 parent 27bcc37 commit 73c1748

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

doc/src/sgml/func.sgml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10525,7 +10525,7 @@ SELECT xpath_exists('/my:a/text()', '<my:a xmlns:my="http://example.com">test</m
1052510525
</indexterm>
1052610526

1052710527
<synopsis>
10528-
<function>xmltable</function>( <optional>XMLNAMESPACES(<replaceable>namespace uri</replaceable> AS <replaceable>namespace name</replaceable><optional>, ...</optional>)</optional>
10528+
<function>xmltable</function>( <optional>XMLNAMESPACES(<replaceable>namespace uri</replaceable> AS <replaceable>namespace name</replaceable><optional>, ...</optional>), </optional>
1052910529
<replaceable>row_expression</replaceable> PASSING <optional>BY REF</optional> <replaceable>document_expression</replaceable> <optional>BY REF</optional>
1053010530
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>
1053110531
| FOR ORDINALITY }
@@ -10708,6 +10708,36 @@ SELECT xmltable.*
1070810708
element
1070910709
----------------------
1071010710
Hello2a2 bbbCC
10711+
]]></screen>
10712+
</para>
10713+
10714+
<para>
10715+
The following example illustrates how
10716+
the <literal>XMLNAMESPACES</literal> clause can be used to specify
10717+
the default namespace, and a list of additional namespaces
10718+
used in the XML document as well as in the XPath expressions:
10719+
10720+
<screen><![CDATA[
10721+
WITH xmldata(data) AS (VALUES ('
10722+
<example xmlns="http://example.com/myns" xmlns:B="http://example.com/b">
10723+
<item foo="1" B:bar="2"/>
10724+
<item foo="3" B:bar="4"/>
10725+
<item foo="4" B:bar="5"/>
10726+
</example>'::xml)
10727+
)
10728+
SELECT xmltable.*
10729+
FROM XMLTABLE(XMLNAMESPACES('http://example.com/myns' AS x,
10730+
'http://example.com/b' AS "B"),
10731+
'/x:example/x:item'
10732+
PASSING (SELECT data FROM xmldata)
10733+
COLUMNS foo int PATH '@foo',
10734+
bar int PATH '@B:bar');
10735+
foo | bar
10736+
-----+-----
10737+
1 | 2
10738+
3 | 4
10739+
4 | 5
10740+
(3 rows)
1071110741
]]></screen>
1071210742
</para>
1071310743
</sect3>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy