help with pgxml_xpath - Mailing list pgsql-general

From Jeff MacDonald
Subject help with pgxml_xpath
Date
Msg-id HJEPJELDKPJEEIIFNLNHEEDOCAAA.jeff@interchange.ca
Whole thread Raw
List pgsql-general
Hi,

I have a table where a typical query looks like this.

cfm=> SELECT loginid,userdata FROM urdr_users where id = 110;
 loginid |                  userdata
---------+---------------------------------------------
 110     | <opt dob="1900-01-01" dft_entityid="74" />

I need to extract the dft_entityid from the xml, i've done this.

cfm=> SELECT loginid,pgxml_xpath(userdata,'//@dft_entityid/','','') FROM
urdr_users where id = 110;
 loginid |    pgxml_xpath
---------+--------------------
 110     |  dft_entityid="74"

That is as close as i can get.. I'd like to be able to extract just the 74.

Any help would be greatly appreciated.

Thanks.

Jeff.


pgsql-general by date:

Previous
From: "Nigel J. Andrews"
Date:
Subject: Re: referential integrity violation
Next
From: darthxiong@libero.it
Date:
Subject: plpgsql and escape