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 1nShZw-000160-Ua for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Mar 2022 15:53:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nShZv-0001oC-Nb for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Mar 2022 15:53:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nShZv-0001jh-En for pgsql-bugs@lists.postgresql.org; Fri, 11 Mar 2022 15:53:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nShZt-0004o5-5c for pgsql-bugs@lists.postgresql.org; Fri, 11 Mar 2022 15:53:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 22BFrFHk877003; Fri, 11 Mar 2022 10:53:15 -0500 From: Tom Lane To: Andrey Kapliev cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: possible bug in xpath function In-reply-to: References: <951FB44B-9C6A-4147-AE9A-796360B72FD5@hxcore.ol> Comments: In-reply-to Andrey Kapliev message dated "Thu, 10 Mar 2022 17:07:13 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <877001.1647013995.1@sss.pgh.pa.us> Date: Fri, 11 Mar 2022 10:53:15 -0500 Message-ID: <877002.1647013995@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrey Kapliev writes: > It looks like XPATH name() function called from xpath() PostgreSQL > function behave differently than when called from XMLTABLE() > PATH. Your examples are by no means equivalent: in particular the XMLTABLE example is using an absolute path //* while the xpath example is implicitly using a relative path. > This > behavior is different from that of 9.6 version where xpath correctly > returns names of the nodes. I think this was an intentional change in v11. The 11.0 release notes mention * Correctly handle relative path expressions in xmltable(), xpath(), and other XML-handling functions (Markus Winand) Per the SQL standard, relative paths start from the document node of the XML input document, not the root node as these functions previously did. regards, tom lane