diff options
author | Neil Conway <neilc@samurai.com> | 2007-05-29 04:58:43 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2007-05-29 04:58:43 +0000 |
commit | 6af04882de5c519d7e49af8e69a031d2b3b46adc (patch) | |
tree | b134e2f4f34897c2b0fe1a663c3d97d17f9f35f9 /src/include | |
parent | e78720ff2f93dcb82484a310d86ce9875385bc20 (diff) |
Fix a bug in input processing for the "interval" type. Previously,
"microsecond" and "millisecond" units were not considered valid input
by themselves, which caused inputs like "1 millisecond" to be rejected
erroneously.
Update the docs, add regression tests, and backport to 8.2 and 8.1
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/utils/datetime.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index df6cf5e4f30..34b88ad5c7a 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.65 2007/02/19 17:41:39 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.66 2007/05/29 04:58:43 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -100,17 +100,19 @@ #define HOUR 10 #define MINUTE 11 #define SECOND 12 -#define DOY 13 -#define DOW 14 -#define UNITS 15 -#define ADBC 16 +#define MILLISECOND 13 +#define MICROSECOND 14 +#define DOY 15 +#define DOW 16 +#define UNITS 17 +#define ADBC 18 /* these are only for relative dates */ -#define AGO 17 -#define ABS_BEFORE 18 -#define ABS_AFTER 19 +#define AGO 19 +#define ABS_BEFORE 20 +#define ABS_AFTER 21 /* generic fields to help with parsing */ -#define ISODATE 20 -#define ISOTIME 21 +#define ISODATE 22 +#define ISOTIME 23 /* reserved for unrecognized string values */ #define UNKNOWN_FIELD 31 @@ -175,8 +177,10 @@ #define DTK_M(t) (0x01 << (t)) +/* Convenvience: a second, plus any fractional component */ +#define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) #define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY)) -#define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_M(SECOND)) +#define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M) #define MAXDATELEN 63 /* maximum possible length of an input date * string (not counting tr. null) */ |