Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNmcS-0002yv-MH for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Oct 2019 23:34:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iNmcR-0004JV-C6 for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Oct 2019 23:34:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNmcR-0004JO-4i for pgsql-bugs@lists.postgresql.org; Thu, 24 Oct 2019 23:34:15 +0000 Received: from anastigmatix.net ([68.171.219.55]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNmcP-0006ZG-43 for pgsql-bugs@lists.postgresql.org; Thu, 24 Oct 2019 23:34:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cM//aefQagxdUZVTGyyOuTAaFynlnfFRdQeo9IAuzZ8=; b=YTSqxGUfwf8UxtJBUr96l2zWXw s9MxqC8LouttMzXQGh93zh2YhRUzpiGpwR01injgPb2MKgRzvQWKLkGsiPl0+HTOXo9CCuMJfdBII HCVkZx/B9JyMgOJm1cZn+FOntyqtlNP2YWjhJ+J7XFz9uYZgq7lG4yjYiPSAQtM8uAqDQbwdj9PL/ kK4E/j0VR8U+WUWB4ARAniTixQ6Rtzgnoyb5WHytiGYr2vNe/m/Usbj88ilnC7o6afxW0PthqILS+ s0GdVozv0WHs9AU3Njq7qWt6UTNN/BSfqe98aZwb0NDCHR6bdMd2BAxIQ7T0hROXymGSB1a1QGg7W cvLypJCA==; Received: from [184.19.31.139] (port=40373) by bay.acenet.us with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1iNmcM-003edq-2Z; Thu, 24 Oct 2019 19:34:10 -0400 Subject: Re: BUG #16046: xpath returns CDATA tag along with the value in postgres 12 To: Tom Lane , mostafa_bit0108@hotmail.com References: <16046-a04d0611e7a0c03a@postgresql.org> <10621.1571953091@sss.pgh.pa.us> <5DB23068.3080601@anastigmatix.net> Cc: pgsql-bugs@lists.postgresql.org, Markus Winand , Pavel Stehule From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5DB234F1.1040706@anastigmatix.net> Date: Thu, 24 Oct 2019 19:34:09 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <5DB23068.3080601@anastigmatix.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-94.5 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/24/19 19:14, Chapman Flack wrote: > ]]> > select 5 & 6 <yahoo!> > > Either form of result is correct, and having it respect the form that was > used in the input might even be delightfully smart. > > I haven't looked in the code just now to see if it is intentionally being > delightfully smart, or more simplistic-and-lucky. It appears to be probably unintentional-but-ok: libxml tags a CDATA section differently (XML_CDATA_SECTION_NODE) than a text node (XML_TEXT_NODE), so a CDATA node falls into the catch-all branch of if (cur->type != XML_ATTRIBUTE_NODE && cur->type != XML_TEXT_NODE) where it gets dumped faithfully by xmlNodeDump(), with the upshot that the result always will be well-formed XML, and will respect whether the input was supplied as CDATA or not. We could choose to say that's what we meant it to do all along. Regards, -Chap