Fix incorrect translation of minus-infinity datetimes for json/jsonb.
Tom Lane <tgl@sss.pgh.pa.us>
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 ...)
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/date.c | modified | +1 −2 |
| src/backend/utils/adt/jsonb.c | modified | +16 −38 |
| src/backend/utils/adt/json.c | modified | +28 −44 |
| src/backend/utils/adt/timestamp.c | modified | +1 −2 |
| src/include/utils/date.h | modified | +1 −0 |
| src/include/utils/datetime.h | modified | +1 −0 |
| src/test/regress/expected/jsonb.out | modified | +18 −0 |
| src/test/regress/expected/json.out | modified | +18 −0 |
| src/test/regress/sql/jsonb.sql | modified | +3 −0 |
| src/test/regress/sql/json.sql | modified | +3 −0 |