Re: Relaxing NaN/Infinity restriction in JSON fields

From: Mitar <mmitar(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Relaxing NaN/Infinity restriction in JSON fields
Date: 2019-05-08 06:09:09
Message-ID: CAKLmikMFGy7JJFUBY7SfZxGQwy6nWY51Dt=nD7byVavjoCT0vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

On Mon, May 6, 2019 at 1:21 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 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.

Python supports that, enabled by default:

https://docs.python.org/3/library/json.html#infinite-and-nan-number-values

> There is not, and never has been, any claim that JSON numbers correspond
> to the IEEE spec.

There is note [1], but yes, it does not claim that nor I claimed that.
I am just saying that the reality is that most people these days use
IEEE spec floating numbers so it is sad that those cannot be easily
stored in JSON, or a database.

Mitar

[1] https://tools.ietf.org/html/rfc7159#page-7

--
http://mitar.tnode.com/
https://twitter.com/mitar_m

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Prashant Hunnure 2019-05-08 10:42:03 Postgres Database Hacked
Previous Message Jeremy Schneider 2019-05-08 05:09:25 Re: Amazon Linux Support?