diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-10-20 11:06:24 -0700 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-10-20 11:06:24 -0700 |
commit | 4f33572ee68b515dc2750e265fc0d0312c0d5d3d (patch) | |
tree | 7123a20d24826e90d09708102ee1af463e90ac56 /src/backend/utils/adt/timestamp.c | |
parent | 7fc7125e21bbc1a84b8670e3d8ac7f7f4b204a9d (diff) |
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 ...)
Diffstat (limited to 'src/backend/utils/adt/timestamp.c')
-rw-r--r-- | src/backend/utils/adt/timestamp.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 59108273cde..37c99559b8b 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -75,7 +75,6 @@ typedef struct static TimeOffset time2t(const int hour, const int min, const int sec, const fsec_t fsec); -static void EncodeSpecialTimestamp(Timestamp dt, char *str); static Timestamp dt2local(Timestamp dt, int timezone); static void AdjustTimestampForTypmod(Timestamp *time, int32 typmod); static void AdjustIntervalForTypmod(Interval *interval, int32 typmod); @@ -1507,7 +1506,7 @@ make_interval(PG_FUNCTION_ARGS) /* EncodeSpecialTimestamp() * Convert reserved timestamp data type to string. */ -static void +void EncodeSpecialTimestamp(Timestamp dt, char *str) { if (TIMESTAMP_IS_NOBEGIN(dt)) |