Search Postgresql Archives

Re: "JSON does not support infinite date values"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/26/2015 08:27 AM, Tim Smith wrote:
Seriously? Json not supporting infinity makes it useless. Ok, so it has
been useless for the, I don't know, last 10 years?

Just face it Andres, it should have never been coded that way in the
first place.  The fact that it appears that nobody in the last 10
years has used "infinity" in conjunction with JSON functions is your
problem, not mine.

You really need to pay attention to the conversation instead of getting wrapped up in your own drama. As was stated and shown, previously(9.3+) Postgres did what you want. The behavior change you discovered was done as part of the changes in 9.4 to be ISO 8601 compliant:

http://www.postgresql.org/docs/9.4/interactive/release-9-4.html

When converting values of type date, timestamp or timestamptz to JSON, render the values in a format compliant with ISO 8601 (Andrew Dunstan)

Previously such values were rendered according to the current DateStyle setting; but many JSON processors require timestamps to be in ISO 8601 format. If necessary, the previous behavior can be obtained by explicitly casting the datetime value to text before passing it to the JSON conversion function


Reading the above gets you:

test=# select version();
version
-----------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.4.1 on i686-pc-linux-gnu, compiled by gcc (SUSE Linux) 4.8.1 20130909 [gcc-4_8-branch revision 202388], 32-bit
(1 row)


test=# select to_json(row('infinity'::date::text));
      to_json
-------------------
 {"f1":"infinity"}
(1 row)


Now both a core developer and the developer driving the JSON bus agree with you that the above is probably not the best solution and the behavior should return to its previous state. So please, take yes for an answer and move on.





--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux