timestamptz_izone should return the input, not NULL, when the input
is a non-finite timestamp, for consistency with related functions. In other words: +infinity rotated to a different timezone is still +infinity.
This commit is contained in:
parent
a239af02c3
commit
f2ebd01ef0
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.152 2005/09/09 02:31:49 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.153 2005/09/09 06:46:14 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -1897,18 +1897,14 @@ timestamp_mi(PG_FUNCTION_ARGS)
|
||||||
result = (Interval *) palloc(sizeof(Interval));
|
result = (Interval *) palloc(sizeof(Interval));
|
||||||
|
|
||||||
if (TIMESTAMP_NOT_FINITE(dt1) || TIMESTAMP_NOT_FINITE(dt2))
|
if (TIMESTAMP_NOT_FINITE(dt1) || TIMESTAMP_NOT_FINITE(dt2))
|
||||||
{
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("cannot subtract infinite timestamps")));
|
errmsg("cannot subtract infinite timestamps")));
|
||||||
|
|
||||||
result->time = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#ifdef HAVE_INT64_TIMESTAMP
|
#ifdef HAVE_INT64_TIMESTAMP
|
||||||
result->time = dt1 - dt2;
|
result->time = dt1 - dt2;
|
||||||
#else
|
#else
|
||||||
result->time = JROUND(dt1 - dt2);
|
result->time = JROUND(dt1 - dt2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result->month = 0;
|
result->month = 0;
|
||||||
|
@ -4196,7 +4192,7 @@ timestamptz_izone(PG_FUNCTION_ARGS)
|
||||||
int tz;
|
int tz;
|
||||||
|
|
||||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||||
PG_RETURN_NULL();
|
PG_RETURN_TIMESTAMP(timestamp);
|
||||||
|
|
||||||
if (zone->month != 0)
|
if (zone->month != 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
|
Loading…
Reference in New Issue