Search Postgresql Archives

Re: Converting xml to table with optional elements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux