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 1jlxfn-0005zy-Kk for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jun 2020 16:45:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlxfl-0003jb-RU for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jun 2020 16:45:53 +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 1jlxfl-0003go-KU for pgsql-hackers@lists.postgresql.org; Thu, 18 Jun 2020 16:45:53 +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 1jlxff-00010H-3Q for pgsql-hackers@lists.postgresql.org; Thu, 18 Jun 2020 16:45:52 +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 05IGjkqb1553462; Thu, 18 Jun 2020 12:45:46 -0400 From: Tom Lane To: Alexander Korotkov cc: Oleg Bartunov , PostgreSQL Hackers Subject: Re: jsonpath versus NaN In-reply-to: References: <203949.1591879542@sss.pgh.pa.us> <355114.1591902003@sss.pgh.pa.us> <1446772.1592407984@sss.pgh.pa.us> <1552001.1592496464@sss.pgh.pa.us> Comments: In-reply-to Alexander Korotkov message dated "Thu, 18 Jun 2020 19:34:32 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1553460.1592498746.1@sss.pgh.pa.us> Date: Thu, 18 Jun 2020 12:45:46 -0400 Message-ID: <1553461.1592498746@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alexander Korotkov writes: > Thank you for your answer. I'm trying to understand your point. > Standard claims that .double() method should behave the same way as > CAST to double. However, standard references the standard behavior of > CAST here, not behavior of your implementation of CAST. So, if we > extend the functionality of standard CAST in our implementation, that > doesn't automatically mean we should extend the .double() jsonpath > method in the same way. Is it correct? Right. We could, if we chose, extend jsonpath to allow Inf/NaN, but I don't believe there's an argument that the spec requires us to. Also the larger point is that it doesn't make sense to extend jsonpath that way when we haven't extended json(b) that way. This code wart wouldn't exist were it not for that inconsistency. Also, I find it hard to see why anyone would have a use for NaN in a jsonpath test when they can't write NaN in the input json data, nor have it be correctly reflected into output json data either. Maybe there's a case for extending json(b) that way; it wouldn't be so different from the work I'm doing nearby to extend type numeric for infinities. But we'd have to have a conversation about whether interoperability with other JSON implementations is worth sacrificing to improve consistency with our float and numeric datatypes. In the meantime, though, we aren't allowing Inf/NaN in json(b) so I don't think jsonpath should accept them either. regards, tom lane