diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-14 17:12:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-14 17:12:33 +0000 |
commit | a303e4dc431627231238c9071ae79198c95b4581 (patch) | |
tree | bb7938d9f2350accf70b2381d75b278d48178220 /src/backend/utils/adt/xml.c | |
parent | 791359fe0eae83641f0929159d5861359d395e97 (diff) | |
download | postgresql-a303e4dc431627231238c9071ae79198c95b4581.tar.gz postgresql-a303e4dc431627231238c9071ae79198c95b4581.zip |
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.
Diffstat (limited to 'src/backend/utils/adt/xml.c')
-rw-r--r-- | src/backend/utils/adt/xml.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 4ef1f97ea78..e728e1254f5 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -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); |