Re: [GENERAL] How to parse xml containing optional elements

2016-08-12 Thread Hannes Erven
Hi, apt-get upgrade postgresql-9.1 returns Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: openssl : Depends: libssl1.0.0 (>= 1.0.1e-2+deb7u5) b

Re: [GENERAL] How to parse xml containing optional elements

2016-08-12 Thread Andrus
Hi! Thank you. How to upgrade in Debian Squeeze ? A plain "apt-get upgrade postgresql-9.1" does not work? It might help to enable the postgresql.org APT repository. For instructions, see here: https://www.postgresql.org/download/linux/debian/ apt-get upgrade postgresql-9.1 returns Reading

Re: [GENERAL] How to parse xml containing optional elements

2016-08-12 Thread Hannes Erven
Andrus, Psotgres 9.1 run isn Debian Squeeze which is unsupported. How to upgrade in Debian Squeeze ? A plain "apt-get upgrade postgresql-9.1" does not work? It might help to enable the postgresql.org APT repository. For instructions, see here: https://www.postgresql.org/download/linux/debia

Re: [GENERAL] How to parse xml containing optional elements

2016-08-12 Thread Andrus
Hi! I couldn't really believe this so I just installed a VM and a 9.1 postgresql just to test this for you. It seems you hit a bug in PostgreSQL prior to 9.1.15: https://www.postgresql.org/docs/9.1/static/release-9-1-15.html "Fix namespace handling in xpath() (Ali Akbar) Previously, the xml va

Re: [GENERAL] How to parse xml containing optional elements

2016-08-11 Thread Hannes Erven
Hi, Thank you. In "PostgreSQL 9.1.2 on x86_64-unknown-linux-gnu, compiled by gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 64-bit" it returns two empty rows. How to make it work in this version ? I couldn't really believe this so I just installed a VM and a 9.1 postgresql just to test this for you.

Re: [GENERAL] How to parse xml containing optional elements

2016-08-11 Thread Andrus
rus. -Algsõnum- From: Hannes Erven Sent: Thursday, August 11, 2016 11:51 AM To: Andrus Cc: pgsql-general Subject: Re: [GENERAL] How to parse xml containing optional elements Hi Andrus, SELECT unnest(xpath('/ns:Document/ns:BkToCstmrStmt/ns:Stmt/ns:Ntry/ns:Amt/text()', x,nsa

Re: [GENERAL] How to parse xml containing optional elements

2016-08-11 Thread Hannes Erven
Hi Andrus, SELECT unnest(xpath('/ns:Document/ns:BkToCstmrStmt/ns:Stmt/ns:Ntry/ns:Amt/text()', x,nsa))::text::numeric AS tasusumma , unnest(xpath('/ns:Document/ns:BkToCstmrStmt/ns:Stmt/ns:Ntry/ns:NtryDtls/ns:TxDtls/ns:Refs/ns:EndToEndId/text()', x,nsa))::text AS orderinr FROM t; You ne

[GENERAL] How to parse xml containing optional elements

2016-08-10 Thread Andrus
SEPA ISO XML transactions file needs to be parsed into flat table in Postgres 9.1+ in ASP:NET 4.6 MVC controller. I tried code below but this produces wrong result: tasusumma orderinr 150.00 PV04131 0.38 PV04131 Since there is no EndToEnd in second row there should be null in secon