From 4f33572ee68b515dc2750e265fc0d0312c0d5d3d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 20 Oct 2015 11:06:24 -0700 Subject: 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 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/backend/utils/adt/date.c') diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index bb23b12c171..02f0afba4c1 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -40,7 +40,6 @@ #endif -static void EncodeSpecialDate(DateADT dt, char *str); static int time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec); static int timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp); static int tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result); @@ -273,7 +272,7 @@ make_date(PG_FUNCTION_ARGS) /* * Convert reserved date values to string. */ -static void +void EncodeSpecialDate(DateADT dt, char *str) { if (DATE_IS_NOBEGIN(dt)) -- cgit v1.2.3