Re: Converting xml to table with optional elements

Поиск
Список
Период
Сортировка
Искать
От
Andrus
Тема
Re: Converting xml to table with optional elements
Дата
Msg-id
203BD69201BA441DAFD612CBB2777EA8@dell2
Ответ на
Список
Дерево обсуждения
Converting xml to table with optional elements "Andrus" <kobruleht2@hot.ee>
Re: Converting xml to table with optional elements David G Johnston <david.g.johnston@gmail.com>
Hi!
 
Thank you.
>Subquery the xpath expression to unnest it and apply a LIMIT 1
> UPDATE tbl SET ... = (SELECT xpath( tbl.???[...] ) LIMIT 1)
 
I used unnest() :
 
update temprid set
  ContactFirstName =unnest(xpath(
     '/E-Document/Document/DocumentParties/BuyerParty/ContactData/ContactFirstName/text()',x))::text
 
Is this OK ?
 
 
>Note that I do not believe your example code is going to work.  As I mentioned you really want to create a >table of documents and NOT try to pair up multiple unnested columns.
 
How to create table of documents ?
 
xml contains multiple products and document info.
Code creates table containing one row for every product and adds same header fields to all rows.
Whu this will not work ?
 
Andrus.
 
В списке pgsql-general по дате отправления
От: Misa Simic
Дата:
От: David Johnston
Дата:
FAQ