Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mTuki-0007Dh-W2 for pgsql-general@arkaria.postgresql.org; Fri, 24 Sep 2021 23:37:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mTukg-00079I-El for pgsql-general@arkaria.postgresql.org; Fri, 24 Sep 2021 23:37:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mTukg-00079A-1S for pgsql-general@lists.postgresql.org; Fri, 24 Sep 2021 23:37:10 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mTukd-0006GS-Bx for pgsql-general@postgresql.org; Fri, 24 Sep 2021 23:37:09 +0000 Received: by mail-il1-x12a.google.com with SMTP id x2so12246709ilm.2 for ; Fri, 24 Sep 2021 16:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=foH7JZtkU9IaYipf1l5nL6baNBbBcRvOB6iQ2J+QPYk=; b=Agf4cv/InfAflnjZp3coL3HxQkdAZ8Q782goz3lgEISLPkdAdgObc0MOPrSTaDv0wq qAycsnAVmLf8nCdjfNrzNgPHdl+642rb67jS8CTMJESi/gYIzqT0IesXzFA49nix7RRW usfuy+9ThygDZ1P5ESXLGzCYXwapSUt90FhUyLa2GWWEtEKnpF5/iA3KivN30D8Mr4cj n3XxFAgxrWQCAH3owVqJbAre5+rAY0+n65GQ7t/jAozaqnV/Jm89tpY4XT5f5P6r9B8y lGdd3SJWdcEfRlXgIDLTTtextK95fwY5yLDniFBk/DoFq40pgzoAZKUvtNFIsGhCkFFA qL7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=foH7JZtkU9IaYipf1l5nL6baNBbBcRvOB6iQ2J+QPYk=; b=0VpMzfpCxefWLB+dnIYmg9UxXWJboX7gTNu5zoI0L62XiiqvttBqGY81rXkAPAC7aY aGZ+s9mZurL7/KTa4ynXjqRwPugvVcHL7d9NRwaGfWmW+XenpC6XK5FA/jhhlzLrZ89I ARVUeA3stCyTjtmsZAB3S5HHikB5aRl81gasBNs9thrbi8kr7mv156hY5xNQl/6L0xdM sljSVlIazz3Ic1Xsjr8cud1JMiw0iq7xlt+2PIQB7RCpVNVB3HwOVrirM4vWZyUDbXti myoPBLvoV7rPY4clxqyO18wCQneGH09jbqNGhqhGlIUB6XxHXYm408lkFfhmPRvDmkBz GrbQ== X-Gm-Message-State: AOAM531gfxoU69qcJdtB1c5BNMCPkIPknNc7OeWdz0133QIGKAJpGDL/ aqllVil2Rm7B6FBWJFd5fZ8RKWudg2E= X-Google-Smtp-Source: ABdhPJxBkRhLaGAbCjD3YyXVfkDb4xGSsLB3jxXnfQWYwuSrqtybXzsa9mElMGsiACUe9TVVhxJfLw== X-Received: by 2002:a92:d352:: with SMTP id a18mr10255257ilh.160.1632526624875; Fri, 24 Sep 2021 16:37:04 -0700 (PDT) Received: from smtpclient.apple ([2601:681:5500:dde0:a481:65f3:da38:6b26]) by smtp.gmail.com with ESMTPSA id r20sm4577667ioh.19.2021.09.24.16.37.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Sep 2021 16:37:04 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-5465E170-8205-48A1-BBF2-A4B8CAC69E2F Content-Transfer-Encoding: 7bit From: Rob Sargent Mime-Version: 1.0 (1.0) Subject: Re: Using XMLNAMESPACES with XMLEMENT Date: Fri, 24 Sep 2021 17:37:03 -0600 Message-Id: References: Cc: pgsql-general@postgresql.org In-Reply-To: To: Garfield Lewis X-Mailer: iPhone Mail (18G82) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail-5465E170-8205-48A1-BBF2-A4B8CAC69E2F Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Sep 24, 2021, at 4:54 PM, Garfield Lewis wr= ote: >=20 > =EF=BB=BF > I=E2=80=99m using PG v12.6 and no I haven=E2=80=99t tried the path functio= n. Do you have an example? > =20 > --=20 > Regards, > Garfield A. Lewis > =20 > From: Rob Sargent > Date: Friday, September 24, 2021 at 6:52 PM > To: Garfield Lewis > Cc: "pgsql-general@postgresql.org" > Subject: Re: Using XMLNAMESPACES with XMLEMENT > =20 > =20 >=20 >=20 > On Sep 24, 2021, at 3:44 PM, Garfield Lewis wr= ote: >=20 > Hi All, > =20 > I am attempting to port the following statement from DB2z to Postgres: > =20 > SELECT e.empno, e.firstnme, e.lastname, > XMLELEMENT ( NAME "foo:Emp", > XMLNAMESPACES('http://www.foo.com' AS "foo"), > XMLATTRIBUTES(e.empno as "serial"), > e.firstnme, > e.lastname ) AS "Result" > FROM EMP e > WHERE e.edlevel =3D 12; > =20 > The NAMESPACES function is not supported by Postgres in the XMLELEMENT fun= ction. Is there any way to get this to work? I=E2=80=99ve looked at the WITH= syntax but it doesn=E2=80=99t look like that will be helpful here. > =20 > =20 > Which Postgres version? Have you tried path function? > Regards, > Garfield https://www.postgresql.org/docs/12/functions-xml.html#FUNCTIONS-XML-PROCESSI= NG= --Apple-Mail-5465E170-8205-48A1-BBF2-A4B8CAC69E2F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Sep 24, 2021, at 4:54 PM, Garfield Lewis &= lt;garfield.lewis@lzlabs.com> wrote:

=EF=BB=BF

I=E2=80= =99m using PG v12.6 and no I haven=E2=80=99t tried the path function. Do you= have an example?

 

-- 

Regards,

Garfield A. Lewis<= /span>

=  

From: Rob Sargent <robjsargent@gmail.com>
Date: Friday, September 24, 2021 at 6:52 PM
To: Garfield Lewis <garfield.lewis@lzlabs.com>
Cc: "pgsql-general@postgresql.org" <pgsql-general@postgresql.org&g= t;
Subject: Re: Using XMLNAMESPACES with XMLEMENT

 

 



On Sep 24, 2021, at 3:= 44 PM, Garfield Lewis <garfield.lewis@lzlabs.com> wrote:

Hi Al= l,

 = ;

I am a= ttempting to port the following statement from DB2z to Postgres:=

 = ;

SELECT e.empno, e.firstnme, e.lastname,

          XMLELEMENT ( NAME "foo:Emp",

  &= nbsp;         XMLNAMESPACES('http://www.foo.com' AS <= /span>"fo= o")<= /span>,

            XMLATTRIBUTES(e= .empno as "serial"),

                    &= nbsp;     e.firstnme,

                    &= nbsp;     e.lastname ) AS "Result"

       FROM EMP e

       WHERE e.edlevel =3D 12;

 = ;

The N= AMESPACES function is not supported by Postgres in the XMLELEMENT function. I= s there any way to get this to work? I=E2=80=99ve looked at the WITH syntax b= ut it doesn=E2=80=99t look like that will be helpful here.

 = ;

 

Which Postgres versi= on?  Have you tried path function?

Regar= ds,

Garfi= eld


= --Apple-Mail-5465E170-8205-48A1-BBF2-A4B8CAC69E2F--