Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fc92450

Browse files
committed
Add an errdetail explaining why we reject infinite dates and timestamps
while converting to XML. Bernd Helmle
1 parent 25bf7f8 commit fc92450

File tree

1 file changed

+7
-4
lines changed
  • src/backend/utils/adt

1 file changed

+7
-4
lines changed

src/backend/utils/adt/xml.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.84 2009/03/23 21:00:39 adunstan Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.85 2009/03/27 18:56:57 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1627,7 +1627,8 @@ map_sql_value_to_xml_value(Datum value, Oid type)
16271627
if (DATE_NOT_FINITE(date))
16281628
ereport(ERROR,
16291629
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
1630-
errmsg("date out of range")));
1630+
errmsg("date out of range"),
1631+
errdetail("XML does not support infinite date values.")));
16311632
j2date(date + POSTGRES_EPOCH_JDATE,
16321633
&(tm.tm_year), &(tm.tm_mon), &(tm.tm_mday));
16331634
EncodeDateOnly(&tm, USE_XSD_DATES, buf);
@@ -1649,7 +1650,8 @@ map_sql_value_to_xml_value(Datum value, Oid type)
16491650
if (TIMESTAMP_NOT_FINITE(timestamp))
16501651
ereport(ERROR,
16511652
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
1652-
errmsg("timestamp out of range")));
1653+
errmsg("timestamp out of range"),
1654+
errdetail("XML does not support infinite timestamp values.")));
16531655
else if (timestamp2tm(timestamp, NULL, &tm, &fsec, NULL, NULL) == 0)
16541656
EncodeDateTime(&tm, fsec, NULL, &tzn, USE_XSD_DATES, buf);
16551657
else
@@ -1675,7 +1677,8 @@ map_sql_value_to_xml_value(Datum value, Oid type)
16751677
if (TIMESTAMP_NOT_FINITE(timestamp))
16761678
ereport(ERROR,
16771679
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
1678-
errmsg("timestamp out of range")));
1680+
errmsg("timestamp out of range"),
1681+
errdetail("XML does not support infinite timestamp values.")));
16791682
else if (timestamp2tm(timestamp, &tz, &tm, &fsec, &tzn, NULL) == 0)
16801683
EncodeDateTime(&tm, fsec, &tz, &tzn, USE_XSD_DATES, buf);
16811684
else

0 commit comments

Comments
 (0)