Fix incorrect translation of minus-infinity datetimes for json/jsonb.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 20 Oct 2015 18:06:24 +0000 (11:06 -0700)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 20 Oct 2015 18:07:04 +0000 (11:07 -0700)
commitd4355425831fe8f6a68095393e3628cb30d06b3f
tree205b0f8d5b11ff62b923090f76ca489bbb48ba84
parent984ae04a2c35e4cd0066ef2e2fb364299ff51c36
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 ...)
src/backend/utils/adt/date.c
src/backend/utils/adt/json.c
src/backend/utils/adt/jsonb.c
src/backend/utils/adt/timestamp.c
src/include/utils/date.h
src/include/utils/datetime.h
src/test/regress/expected/json.out
src/test/regress/expected/jsonb.out
src/test/regress/sql/json.sql
src/test/regress/sql/jsonb.sql