Compare commits

..

No commits in common. "807369d80384cdaa696cd65b4fcee46e32142344" and "60ba7cae7cc758f09899429d1134a14adc35fd94" have entirely different histories.

4 changed files with 5 additions and 31 deletions

View File

@ -90,8 +90,7 @@ assign_param_for_var(PlannerInfo *root, Var *var)
pvar->varattno == var->varattno &&
pvar->vartype == var->vartype &&
pvar->vartypmod == var->vartypmod &&
pvar->varcollid == var->varcollid &&
bms_equal(pvar->varnullingrels, var->varnullingrels))
pvar->varcollid == var->varcollid)
return pitem->paramId;
}
}

View File

@ -2966,16 +2966,8 @@ timestamp_pl_interval(PG_FUNCTION_ARGS)
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
errmsg("timestamp out of range")));
/*
* Add days by converting to and from Julian. We need an overflow
* check here since j2date expects a non-negative integer input.
*/
julian = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday);
if (pg_add_s32_overflow(julian, span->day, &julian) ||
julian < 0)
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
errmsg("timestamp out of range")));
/* Add days by converting to and from Julian */
julian = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + span->day;
j2date(julian, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
if (tm2timestamp(tm, fsec, NULL, &timestamp) != 0)
@ -3088,19 +3080,8 @@ timestamptz_pl_interval_internal(TimestampTz timestamp,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
errmsg("timestamp out of range")));
/*
* Add days by converting to and from Julian. We need an overflow
* check here since j2date expects a non-negative integer input.
* In practice though, it will give correct answers for small
* negative Julian dates; we should allow -1 to avoid
* timezone-dependent failures, as discussed in timestamp.h.
*/
julian = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday);
if (pg_add_s32_overflow(julian, span->day, &julian) ||
julian < -1)
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
errmsg("timestamp out of range")));
/* Add days by converting to and from Julian */
julian = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + span->day;
j2date(julian, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
tz = DetermineTimeZoneOffset(tm, attimezone);

View File

@ -482,8 +482,6 @@ SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days'
Sun Dec 31 00:00:00 294276
(1 row)
SELECT timestamp without time zone '2000-01-01' - interval '2483590 days' AS "out of range";
ERROR: timestamp out of range
SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days";
106751991 Days
------------------
@ -744,8 +742,6 @@ SELECT timestamp with time zone '1999-12-01' + interval '1 month - 1 second' AS
Fri Dec 31 23:59:59 1999 PST
(1 row)
SELECT timestamp with time zone '2000-01-01' - interval '2483590 days' AS "out of range";
ERROR: timestamp out of range
SELECT (timestamp with time zone 'today' = (timestamp with time zone 'yesterday' + interval '1 day')) as "True";
True
------

View File

@ -120,7 +120,6 @@ SELECT timestamp without time zone '1999-12-01' + interval '1 month - 1 second'
SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days' AS "Feb 23, 285506";
SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244";
SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276";
SELECT timestamp without time zone '2000-01-01' - interval '2483590 days' AS "out of range";
SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days";
-- Shorthand values
@ -152,7 +151,6 @@ SELECT timestamp with time zone '1996-03-01' - interval '1 second' AS "Feb 29";
SELECT timestamp with time zone '1999-03-01' - interval '1 second' AS "Feb 28";
SELECT timestamp with time zone '2000-03-01' - interval '1 second' AS "Feb 29";
SELECT timestamp with time zone '1999-12-01' + interval '1 month - 1 second' AS "Dec 31";
SELECT timestamp with time zone '2000-01-01' - interval '2483590 days' AS "out of range";
SELECT (timestamp with time zone 'today' = (timestamp with time zone 'yesterday' + interval '1 day')) as "True";
SELECT (timestamp with time zone 'today' = (timestamp with time zone 'tomorrow' - interval '1 day')) as "True";