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 1hNk8N-00062D-Oq for pgsql-general@arkaria.postgresql.org; Mon, 06 May 2019 20:22:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hNk7O-00054u-9g for pgsql-general@arkaria.postgresql.org; Mon, 06 May 2019 20:21:46 +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 1hNk7N-00054n-Vr for pgsql-general@lists.postgresql.org; Mon, 06 May 2019 20:21:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNk7J-0007Ey-D4 for pgsql-general@postgresql.org; Mon, 06 May 2019 20:21:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x46KLaji006324; Mon, 6 May 2019 16:21:36 -0400 From: Tom Lane To: Mitar cc: pgsql-general@postgresql.org Subject: Re: Relaxing NaN/Infinity restriction in JSON fields In-reply-to: References: Comments: In-reply-to Mitar message dated "Mon, 06 May 2019 12:55:41 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6322.1557174096.1@sss.pgh.pa.us> Date: Mon, 06 May 2019 16:21:36 -0400 Message-ID: <6323.1557174096@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Mitar writes: > When migrating from MongoDB to PostgreSQL one thing which just > surprised me now is that I cannot store NaN/Infinity in JSON fields. I > know that standard JSON restricts those values, but they are a very > common (and welcome) relaxation. What are prospects of this > restriction being lifted? The JSON RFC is pretty clear on this matter [1]: Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. Getting us to deviate from the RFC so blatantly would be a very hard sell. A large part of the point of the JSON datatype is to be interoperable; once you give that up you may as well use some not-standard-at-all representation. > It is really sad that one cannot stores > directly all IEEE 754 double precision floating point values. There is not, and never has been, any claim that JSON numbers correspond to the IEEE spec. regards, tom lane [1] https://tools.ietf.org/html/rfc7159#page-6