diff options
| author | Tom Lane | 2015-10-20 18:06:24 +0000 |
|---|---|---|
| committer | Tom Lane | 2015-10-20 18:06:24 +0000 |
| commit | 4f33572ee68b515dc2750e265fc0d0312c0d5d3d (patch) | |
| tree | 7123a20d24826e90d09708102ee1af463e90ac56 /src/include/utils | |
| 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/include/utils')
| -rw-r--r-- | src/include/utils/date.h | 1 | ||||
| -rw-r--r-- | src/include/utils/datetime.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/include/utils/date.h b/src/include/utils/date.h index 622aa194901..03513e07d7d 100644 --- a/src/include/utils/date.h +++ b/src/include/utils/date.h @@ -92,6 +92,7 @@ typedef struct /* date.c */ extern double date2timestamp_no_overflow(DateADT dateVal); +extern void EncodeSpecialDate(DateADT dt, char *str); extern Datum date_in(PG_FUNCTION_ARGS); extern Datum date_out(PG_FUNCTION_ARGS); diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index 9b53ee38ccf..a091f6fa04b 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -319,6 +319,7 @@ extern void EncodeDateOnly(struct pg_tm * tm, int style, char *str); extern void EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style, char *str); extern void EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str); extern void EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str); +extern void EncodeSpecialTimestamp(Timestamp dt, char *str); extern int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, struct pg_tm * tm); |
