example for xmltable with XMLNAMESPACES

Поиск
Список
Период
Сортировка
Искать

example for xmltable with XMLNAMESPACES

От:
Arjen Nienhuis <a.g.nienhuis@gmail.com>
Дата:
It wasn't completely clear for me how to use namespaces in xmltable().
Maybe add this to the documentation. It shows the default namespace
and quoting the namespace name.

WITH xmldata(data) AS (VALUES ('

'::xml)
)
SELECT xmltable.* FROM XMLTABLE(XMLNAMESPACES('http://example.com/myns' AS x,                             'http://example.com/b' AS "B"),            '/x:example/x:item'               PASSING (SELECT data FROM xmldata)               COLUMNS foo int PATH '@foo',                 bar int PATH '@B:bar');foo | bar
-----+-----  1 |   2  3 |   4  4 |   5
(3 rows)


FAQ