aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/timestamp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/timestamp.c')
-rw-r--r--src/backend/utils/adt/timestamp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index 8593b6b47f4..ab458155ecb 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -1646,8 +1646,9 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
return -1;
}
/* check for just-barely overflow (okay except time-of-day wraps) */
- if ((*result < 0 && date >= 0) ||
- (*result >= 0 && date < 0))
+ /* caution: we want to allow 1999-12-31 24:00:00 */
+ if ((*result < 0 && date > 0) ||
+ (*result > 0 && date < -1))
{
*result = 0; /* keep compiler quiet */
return -1;