mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-27 07:21:09 +08:00
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
|
||||
* $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,14 +1897,10 @@ timestamp_mi(PG_FUNCTION_ARGS)
|
||||
result = (Interval *) palloc(sizeof(Interval));
|
||||
|
||||
if (TIMESTAMP_NOT_FINITE(dt1) || TIMESTAMP_NOT_FINITE(dt2))
|
||||
{
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||
errmsg("cannot subtract infinite timestamps")));
|
||||
|
||||
result->time = 0;
|
||||
}
|
||||
else
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
result->time = dt1 - dt2;
|
||||
#else
|
||||
@ -4196,7 +4192,7 @@ timestamptz_izone(PG_FUNCTION_ARGS)
|
||||
int tz;
|
||||
|
||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||
PG_RETURN_NULL();
|
||||
PG_RETURN_TIMESTAMP(timestamp);
|
||||
|
||||
if (zone->month != 0)
|
||||
ereport(ERROR,
|
||||
|
Loading…
Reference in New Issue
Block a user