Fix DecodeInterval to report an error for multiple occurrences of DAY, WEEK,
commit1b11903a3392e9187956e9e0813bcba34ea9e20a
authortgl <tgl>
Mon, 1 Jun 2009 16:55:11 +0000 (1 16:55 +0000)
committertgl <tgl>
Mon, 1 Jun 2009 16:55:11 +0000 (1 16:55 +0000)
tree1c3edb750ba8834acb7b57fd413b289ac98563db
parentaf23b3a89d72a3b5c115d1ca86923c310bf242bd
Fix DecodeInterval to report an error for multiple occurrences of DAY, WEEK,
YEAR, DECADE, CENTURY, or MILLENIUM fields, just as it always has done for
other types of fields.  The previous behavior seems to have been a hack to
avoid defining bit-positions for all these field types in DTK_M() masks,
rather than something that was really considered to be desired behavior.
But there is room in the masks for these, and we really need to tighten up
at least the behavior of DAY and YEAR fields to avoid unexpected behavior
associated with the 8.4 changes to interpret ambiguous fields based on the
interval qualifier (typmod) value.  Per my example and proposed patch.
src/backend/utils/adt/datetime.c
src/include/utils/datetime.h