Hi!
You can use XMLTABLE function
select xmltable.*
from t,
lateral
xmltable(xmlnamespaces('urn:iso:std:iso:20022:tech:xsd:camt.053.001.02' as
ns),
'/ns:Document/ns:BkToCstmrStmt/ns:Stmt/ns:Ntry/.' passing t.x
columns tasusumma numeric path 'ns:Amt')
"Andrus" writes:
>> But I have not a idea, why old code doesn't work. It is little bit strange
>> so it worked without namespace before Amt tag.
> In 9.1.5 without namespaces
> (xpath('Amt/text()', x,nsa))[1]::text::numeric AS tasusumma
> works.
> How to make it work in both versions?
I'm har
ne 17. 3. 2019 v 15:11 odesílatel Andrus napsal:
> Hi
>
> >This variant is working
> >postgres=# SELECT
> >(xpath('/ns:Ntry/ns:Amt/text()', x,nsa))[1]::text::numeric AS
> tasusumma
> >FROM (
> >SELECT
> unnest(xpath('/ns:Document/ns:BkToCstmrStmt/ns:Stmt/ns:Ntry',
> >x,nsa)) as x
ne 17. 3. 2019 v 15:19 odesílatel Andrus napsal:
> Hi!
>
> >You can use XMLTABLE function
> >select xmltable.*
> > from t,
> > lateral
> > xmltable(xmlnamespaces('urn:iso:std:iso:20022:tech:xsd:camt.053.001.02'
> as
> > ns),
> >
> > '/ns:Document/ns:BkToCstmrStmt/ns:Stmt/ns:Ntry/.' pass
Hi
>This variant is working
>postgres=# SELECT
>(xpath('/ns:Ntry/ns:Amt/text()', x,nsa))[1]::text::numeric AS tasusumma
>FROM (
>SELECT unnest(xpath('/ns:Document/ns:BkToCstmrStmt/ns:Stmt/ns:Ntry',
>x,nsa)) as x,
>nsa
>FROM t
>) Ntry
>;
>But I have n
Andrus schrieb am 17.03.2019 um 08:36:
In Postgres 9.1.2 script below produces proper results:
1.34
5.56
create temp table t(x xml, nsa text[][]) on commit drop;
insert into t values(
'
http://www.w3.org/2001/XMLSchema-instance";
xmlns="urn:iso:std:iso:20022:tech:xsd:camt.053.001.02">
ne 17. 3. 2019 v 14:49 odesílatel Pavel Stehule
napsal:
> Hi
>
> ne 17. 3. 2019 v 12:11 odesílatel Andrus napsal:
>
>> Hi!
>>
>> In Postgres 9.1.2 script below produces proper results:
>>
>> 1.34
>> 5.56
>>
>> In Postgres 11 it produces wrong results:
>>
>> null
>> null
>>
>> How to make it also
Hi
ne 17. 3. 2019 v 12:11 odesílatel Andrus napsal:
> Hi!
>
> In Postgres 9.1.2 script below produces proper results:
>
> 1.34
> 5.56
>
> In Postgres 11 it produces wrong results:
>
> null
> null
>
> How to make it also to work in newer versions on Postgres ?
>
> create temp table t(x xml, nsa t