From 12f8bd823daf0f4b0d984d35b35300acc51e554c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 8 Nov 2008 20:51:49 +0000 Subject: [PATCH] Fix recently added code for SQL years-months interval syntax so that it behaves correctly for a leading minus sign, zero year value, and nonzero month value. Per discussion with Ron Mayer. --- src/backend/utils/adt/datetime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index f25e3c6ae1..395193b55f 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -2863,7 +2863,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range, if (*cp != '\0') return DTERR_BAD_FORMAT; type = DTK_MONTH; - if (val < 0) + if (*field[i] == '-') val2 = -val2; val = val * MONTHS_PER_YEAR + val2; fval = 0; -- 2.39.5