Re: Relaxing NaN/Infinity restriction in JSON fields

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Relaxing NaN/Infinity restriction in JSON fields
Дата
Msg-id 6323.1557174096@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Relaxing NaN/Infinity restriction in JSON fields  (Mitar <mmitar@gmail.com>)
Ответы Re: Relaxing NaN/Infinity restriction in JSON fields  (Mitar <mmitar@gmail.com>)
Список pgsql-general
Mitar <mmitar@gmail.com> 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Mitar
Дата:
Сообщение: Relaxing NaN/Infinity restriction in JSON fields
Следующее
От: Brent Wood
Дата:
Сообщение: Re: Postgres for SQL Server users