Re: BUG #13687: bug in row_to_json function with '-infinity' timestamp
От | David G. Johnston |
---|---|
Тема | Re: BUG #13687: bug in row_to_json function with '-infinity' timestamp |
Дата | |
Msg-id | CAKFQuwaCK2N3BCDZMrFgz1a9kONG8cQd239DtH8ajbXTf3x1bw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #13687: bug in row_to_json function with '-infinity' timestamp (Bruce Momjian <bruce@momjian.us>) |
Ответы |
Re: BUG #13687: bug in row_to_json function with
'-infinity' timestamp
Re: BUG #13687: bug in row_to_json function with '-infinity' timestamp |
Список | pgsql-bugs |
On Mon, Oct 19, 2015 at 11:12 AM, Bruce Momjian <bruce@momjian.us> wrote: > On Mon, Oct 19, 2015 at 10:25:53AM -0400, David G. Johnston wrote: > > On Mon, Oct 19, 2015 at 9:00 AM, <stepanperlov@gmail.com> wrote: > > > > The following bug has been logged on the website: > > > > Bug reference: 13687 > > Logged by: Stepan > > Email address: stepanperlov@gmail.com > > PostgreSQL version: 9.4.5 > > Operating system: Ubuntu 14.04.1 LTS > > Description: > > > > SELECT row_to_json(t) > > FROM (SELECT '-infinity'::timestamptz) t > > > > > > =E2=80=8BWhat do you see happening and what do you think should happen = (and why)? > > Well, the output I see is: > > SELECT row_to_json(t) > FROM (SELECT '-infinity'::timestamptz) t ; > row_to_json > ---------------------------- > {"timestamptz":"infinity"} > > I assume the user expects positive infinity. > =E2=80=8BThe user is expecting negative infinity...which I agree with. Release notes do indicate this incompatibility: >>> 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. =E2=80=8B>>>=E2=80=8B =E2=80=8BBut since ISO 8601 doesn't define infinity our implementation of t= his behavior is not externally constrained and probably shouldn't be changed. David J.
В списке pgsql-bugs по дате отправления: