Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YFxj2-00006q-P9 for pgsql-admin@arkaria.postgresql.org; Tue, 27 Jan 2015 04:26:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YFxj2-0003kC-8J for pgsql-admin@arkaria.postgresql.org; Tue, 27 Jan 2015 04:26:04 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YFxj0-0003g0-68 for pgsql-admin@postgresql.org; Tue, 27 Jan 2015 04:26:02 +0000 Received: from eu1sys200aog103.obsmtp.com ([207.126.144.115]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YFxiw-00005Q-HZ for pgsql-admin@postgresql.org; Tue, 27 Jan 2015 04:26:00 +0000 Received: from mail-wg0-f52.google.com ([74.125.82.52]) (using TLSv1) by eu1sys200aob103.postini.com ([207.126.147.11]) with SMTP ID DSNKVMcTUr/WzL/Zt8Y6CdmbBFTIWOWVAl6g@postini.com; Tue, 27 Jan 2015 04:25:58 UTC Received: by mail-wg0-f52.google.com with SMTP id y19so12544811wgg.11 for ; Mon, 26 Jan 2015 20:25:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:thread-index:date:message-id :subject:to:content-type; bh=RK4PAeD9s+e2J6+8xB7sU95QOJy6ypU9/Cxoe6YKHPQ=; b=Ek5DK0SvOpfPPK/JznmlTguJGmKGUqSzwR/cAlO9Rf15FXNkvK5ZX1RT/MZ2iaLMQI HXviQLbs61ZOt2GJDHozaP7lDhApSlmXadV5BzPuQ2yAmuJAmP65uy7jzTA4Mcr7IL3o ylCoRH7Jh0LPn78KIb7aUzlzwES73mHntlNeiupXCBIrEYaoV0v0snmZ18EPxtK/us1s 6hc7xKVpxThjpF4Ms90NjYqB0rhvwvyxXRQMitAAwzW+bwErGMq+SwD/nDxLNCxy66zg i6yDi3ShSo8ykqupPxCBbUbvoS6QchVTcSkaxHwEdBpwlJFQYQPFh7avEZ3HzHcJK3SJ TAGA== X-Gm-Message-State: ALoCoQkAcLSRe3J5iovzyYXEROmfa3vEiFoBO1uth2K87726HTfRYUXuE2KU+y1tDC3/HOw0IGu6S5io3LWE/a3FzjYkFS92ibx47WYGHgX5TcTDAS8/3p2ue2puY2dGS1iKzWCwFoSnKfj+81RTQAIf50uxWFvg1w== X-Received: by 10.180.95.97 with SMTP id dj1mr1752787wib.43.1422332754163; Mon, 26 Jan 2015 20:25:54 -0800 (PST) X-Received: by 10.180.95.97 with SMTP id dj1mr1752780wib.43.1422332754075; Mon, 26 Jan 2015 20:25:54 -0800 (PST) From: Khangelani Gama MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 thread-index: AdA56UD78uMMqYASQXW2oJz+b6C6Aw== Date: Tue, 27 Jan 2015 06:25:52 +0200 Message-ID: <203fb35202e040e00d0d3ed514414a2a@mail.gmail.com> Subject: Postgres 9.2 - XML string functions ? To: pgsql-admin@postgresql.org Content-Type: multipart/alternative; boundary=f46d0418251e8f34f6050d9aa665 X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org --f46d0418251e8f34f6050d9aa665 Content-Type: text/plain; charset=UTF-8 Hi Please help, I have been asked why XML string functions do this, which is why does the second statement below return no rows. No matter what is on the select statement, they can select as many columns as they want but the XML function breaks it as soon as it is added. 1) select aud_id,act_typ,right(act_typ::text,1),fpp_cde,obo_aud_id,obo_aud_id||sku_cde as "Key" from sku_tran join audit using (aud_id) join action_typ using (act_typ) join branch using (br_cde) join sku using (sku_cde) where obo_aud_id=5252005 and audit.fpp_cde between '201408' and '201412' and (right(act_typ::text,1) = '5') and act_typ between 76000 and 76999; aud_id | act_typ | right | fpp_cde | obo_aud_id | Key 2585912 | 76005 | 5 | 201408 | 5252005 | 525200510053486 (1 row) 2) select aud_id,act_typ,right(act_typ::text,1),fpp_cde,obo_aud_id,(unnest(xpath('.//checksumBr/text()', aud_xml::xml)))::text||obo_aud_id||sku_cde as "Key" from sku_tran join audit using (aud_id) join action_typ using (act_typ) join branch using (br_cde) join sku using (sku_cde) where obo_aud_id=5252005 and audit.fpp_cde between '201408' and '201412' and (right(act_typ::text,1) = '5') and act_typ between 76000 and 76999; aud_id | act_typ | right | fpp_cde | obo_aud_id | Key (0 rows) CONFIDENTIALITY NOTICE The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by anyone other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer immediately and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no liability for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes. --f46d0418251e8f34f6050d9aa665 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi

=C2=A0

Please help, I have been asked why XML st= ring functions do this, which is why does the second statement below return= no rows. No matter what is on the select statement, they can select as man= y columns as they want but the XML function breaks it as soon as it is adde= d.

=C2=A0

=C2=A0

1)= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select aud_id,act_typ,right(act_typ::= text,1),fpp_cde,obo_aud_id,obo_aud_id||sku_cde as "Key" from sku_= tran join audit using (aud_id) join action_typ using (act_typ) join branch = using (br_cde) join sku using (sku_cde) where obo_aud_id=3D5252005 and audi= t.fpp_cde between '201408' and '201412' and (right(act_typ:= :text,1) =3D '5') and act_typ between 76000 and 76999;

aud_id=C2=A0 | act_typ |= right | fpp_cde | obo_aud_id |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Key

=

2585912 |=C2=A0= =C2=A0 76005 | 5=C2=A0=C2=A0=C2=A0=C2=A0 | 201408 =C2=A0|=C2=A0=C2=A0=C2=A0= 5252005 | 525200510053486

(1 row)

2)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 select aud_= id,act_typ,right(act_typ::text,1),fpp_cde,obo_aud_id,(unnest(xpath('.//= checksumBr/text()', aud_xml::xml)))::text||obo_aud_id||sku_cde as "= ;Key" from sku_tran join audit using (aud_id) join action_typ using (a= ct_typ) join branch using (br_cde) join sku using (sku_cde) where obo_aud_i= d=3D5252005 and audit.fpp_cde between '201408' and '201412'= and (right(act_typ::text,1) =3D '5') and act_typ between 76000 and= 76999;

aud_i= d | act_typ | right | fpp_cde | obo_aud_id | Key

(0 rows)

=C2=A0

=C2=A0

= =C2=A0


CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addre=
ssee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. An=
y review, use or dissemination thereof by anyone
other than the intended addressee is prohibited.If you are not the intend=
ed addressee please notify the writer immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiari=
es distance themselves from and accept no liability
for unauthorised use of their e-mail facilities or e-mails sent other tha=
n strictly for business purposes.
=0D
--f46d0418251e8f34f6050d9aa665--