Skip to content

Commit eec501c

Browse files
committed
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.
1 parent 13fdd0e commit eec501c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/adt/datetime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.195 2008/10/02 13:47:38 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.196 2008/11/08 20:51:49 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2863,7 +2863,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
28632863
if (*cp != '\0')
28642864
return DTERR_BAD_FORMAT;
28652865
type = DTK_MONTH;
2866-
if (val < 0)
2866+
if (*field[i] == '-')
28672867
val2 = -val2;
28682868
val = val * MONTHS_PER_YEAR + val2;
28692869
fval = 0;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy