pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix incorrect translation of minus-infinity datetimes for json/j
Date: Tue, 20 Oct 2015 18:07:17 +0000
Message-ID: <E1ZobJd-0002GR-83@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix incorrect translation of minus-infinity datetimes for json/jsonb.

Commit bda76c1c8cfb1d11751ba6be88f0242850481733 caused both plus and
minus infinity to be rendered as "infinity", which is not only wrong
but inconsistent with the pre-9.4 behavior of to_json().  Fix that by
duplicating the coding in date_out/timestamp_out/timestamptz_out more
closely.  Per bug #13687 from Stepan Perlov.  Back-patch to 9.4, like
the previous commit.

In passing, also re-pgindent json.c, since it had gotten a bit messed up by
recent patches (and I was already annoyed by indentation-related problems
in back-patching this fix ...)

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/5fb20a5ba6ce963ad529224ff5359aa1731c4068

Modified Files
--------------
src/backend/utils/adt/date.c        |    3 +-
src/backend/utils/adt/json.c        |   72 ++++++++++++++---------------------
src/backend/utils/adt/jsonb.c       |   54 ++++++++------------------
src/backend/utils/adt/timestamp.c   |    3 +-
src/include/utils/date.h            |    1 +
src/include/utils/datetime.h        |    1 +
src/test/regress/expected/json.out  |   18 +++++++++
src/test/regress/expected/jsonb.out |   18 +++++++++
src/test/regress/sql/json.sql       |    3 ++
src/test/regress/sql/jsonb.sql      |    3 ++
10 files changed, 90 insertions(+), 86 deletions(-)


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


view thread (3+ messages)

Message-ID: <E1ZobJd-0002GR-83@gemulon.postgresql.org>
Permalink:  ../E1ZobJd-0002GR-83@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ZobJd-0002GR-83@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix incorrect translation of minus-infinity datetimes for json/j
  In-Reply-To: <E1ZobJd-0002GR-83@gemulon.postgresql.org>
  References: <E1ZobJd-0002GR-83@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox