fix-DecodeTimeOnly.patch
text/x-patch
Filename: fix-DecodeTimeOnly.patch
Type: text/x-patch
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/utils/adt/datetime.c | 6 | 0 |
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 54ea69f7f1..0a13ec8492 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -2280,6 +2280,9 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
GetCurrentDateTime(tmp);
else
{
+ /* a date has to be fully specified */
+ if ((fmask & DTK_DATE_M) != DTK_DATE_M)
+ return DTERR_BAD_FORMAT;
tmp->tm_year = tm->tm_year;
tmp->tm_mon = tm->tm_mon;
tmp->tm_mday = tm->tm_mday;
@@ -2307,6 +2310,9 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
GetCurrentDateTime(tmp);
else
{
+ /* a date has to be fully specified */
+ if ((fmask & DTK_DATE_M) != DTK_DATE_M)
+ return DTERR_BAD_FORMAT;
tmp->tm_year = tm->tm_year;
tmp->tm_mon = tm->tm_mon;
tmp->tm_mday = tm->tm_mday;