1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-21 10:42:50 +03:00

Reject out-of-range dates in date_in().

Kris Jurka
This commit is contained in:
Tom Lane
2006-02-09 03:40:42 +00:00
parent f9ce97c5a1
commit a14302080f
2 changed files with 8 additions and 3 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.104.4.2 2005/05/26 02:10:02 neilc Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.104.4.3 2006/02/09 03:40:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -96,6 +96,11 @@ date_in(PG_FUNCTION_ARGS)
break;
}
if (!IS_VALID_JULIAN(tm->tm_year, tm->tm_mon, tm->tm_mday))
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
errmsg("date out of range: \"%s\"", str)));
date = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - POSTGRES_EPOCH_JDATE;
PG_RETURN_DATEADT(date);