map_sql_value_to_xml_value() currently errors out with a more or less vague
error message, when a date or timestamp datatype with an infinite value is
converted to XML. This is likely to create some confusion, especially when
you have to debug some complex procedures and involved XML conversions. I
propose to add the attached DETAIL to this error message, so people will
get an idea what's currently going wrong.
--
Thanks
Bernd
*** a/src/backend/utils/adt/xml.c
--- b/src/backend/utils/adt/xml.c
***************
*** 1627,1632 **** map_sql_value_to_xml_value(Datum value, Oid type)
--- 1627,1633 ----
if (DATE_NOT_FINITE(date))
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
+ errdetail("XML does not support infinite date values."),
errmsg("date out of range")));
j2date(date + POSTGRES_EPOCH_JDATE,
&(tm.tm_year), &(tm.tm_mon), &(tm.tm_mday));
***************
*** 1649,1654 **** map_sql_value_to_xml_value(Datum value, Oid type)
--- 1650,1656 ----
if (TIMESTAMP_NOT_FINITE(timestamp))
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
+ errdetail("XML does not support infinite timestamp values."),
errmsg("timestamp out of range")));
else if (timestamp2tm(timestamp, NULL, &tm, &fsec, NULL, NULL) == 0)
EncodeDateTime(&tm, fsec, NULL, &tzn, USE_XSD_DATES, buf);
***************
*** 1675,1680 **** map_sql_value_to_xml_value(Datum value, Oid type)
--- 1677,1683 ----
if (TIMESTAMP_NOT_FINITE(timestamp))
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
+ errdetail("XML does not support infinite timestamp values."),
errmsg("timestamp out of range")));
else if (timestamp2tm(timestamp, &tz, &tm, &fsec, &tzn, NULL) == 0)
EncodeDateTime(&tm, fsec, &tz, &tzn, USE_XSD_DATES, buf);
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers