OSDN Git Service

Fix DecodeInterval to report an error for multiple occurrences of DAY, WEEK,
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 1 Jun 2009 16:55:11 +0000 (16:55 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 1 Jun 2009 16:55:11 +0000 (16:55 +0000)
commitb3b89fd1f1ab3b1f3052695e51a94713921808a5
treeea76140b24c63e516a7b7b9143d7f7998fc6b7a9
parent5377ccbe2495b81c3b9fbd170841492098875998
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