mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Extend the date type to support infinity and -infinity, analogously to
the timestamp types. Turns out this doesn't even reduce the available range of dates, since the restriction to dates that work for Julian-date arithmetic is much tighter than the int32 range anyway. Per a longstanding TODO item.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.78 2008/10/09 15:49:04 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.79 2008/10/14 17:12:33 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1632,6 +1632,11 @@ map_sql_value_to_xml_value(Datum value, Oid type)
|
||||
char buf[MAXDATELEN + 1];
|
||||
|
||||
date = DatumGetDateADT(value);
|
||||
/* XSD doesn't support infinite values */
|
||||
if (DATE_NOT_FINITE(date))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||
errmsg("date out of range")));
|
||||
j2date(date + POSTGRES_EPOCH_JDATE,
|
||||
&(tm.tm_year), &(tm.tm_mon), &(tm.tm_mday));
|
||||
EncodeDateOnly(&tm, USE_XSD_DATES, buf);
|
||||
|
Reference in New Issue
Block a user