date_recv should accept infinities.

Reported by James William Pye.
This commit is contained in:
Itagaki Takahiro 2010-02-18 04:31:16 +00:00
parent 9529f4d532
commit 1a1ad6320c

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.150 2010/01/02 16:57:53 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.151 2010/02/18 04:31:16 itagaki Exp $
*
*-------------------------------------------------------------------------
*/
@ -208,8 +208,10 @@ date_recv(PG_FUNCTION_ARGS)
result = (DateADT) pq_getmsgint(buf, sizeof(DateADT));
/* Limit to the same range that date_in() accepts. */
if (result < -POSTGRES_EPOCH_JDATE ||
result >= JULIAN_MAX - POSTGRES_EPOCH_JDATE)
if (DATE_NOT_FINITE(result))
/* ok */ ;
else if (result < -POSTGRES_EPOCH_JDATE ||
result >= JULIAN_MAX - POSTGRES_EPOCH_JDATE)
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
errmsg("date out of range")));