mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Add an errdetail explaining why we reject infinite dates and timestamps
while converting to XML. Bernd Helmle
This commit is contained in:
parent
25bf7f8b9b
commit
fc92450e7d
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.84 2009/03/23 21:00:39 adunstan Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.85 2009/03/27 18:56:57 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1627,7 +1627,8 @@ map_sql_value_to_xml_value(Datum value, Oid type)
|
||||
if (DATE_NOT_FINITE(date))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||
errmsg("date out of range")));
|
||||
errmsg("date out of range"),
|
||||
errdetail("XML does not support infinite date values.")));
|
||||
j2date(date + POSTGRES_EPOCH_JDATE,
|
||||
&(tm.tm_year), &(tm.tm_mon), &(tm.tm_mday));
|
||||
EncodeDateOnly(&tm, USE_XSD_DATES, buf);
|
||||
@ -1649,7 +1650,8 @@ map_sql_value_to_xml_value(Datum value, Oid type)
|
||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||
errmsg("timestamp out of range")));
|
||||
errmsg("timestamp out of range"),
|
||||
errdetail("XML does not support infinite timestamp values.")));
|
||||
else if (timestamp2tm(timestamp, NULL, &tm, &fsec, NULL, NULL) == 0)
|
||||
EncodeDateTime(&tm, fsec, NULL, &tzn, USE_XSD_DATES, buf);
|
||||
else
|
||||
@ -1675,7 +1677,8 @@ map_sql_value_to_xml_value(Datum value, Oid type)
|
||||
if (TIMESTAMP_NOT_FINITE(timestamp))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||
errmsg("timestamp out of range")));
|
||||
errmsg("timestamp out of range"),
|
||||
errdetail("XML does not support infinite timestamp values.")));
|
||||
else if (timestamp2tm(timestamp, &tz, &tm, &fsec, &tzn, NULL) == 0)
|
||||
EncodeDateTime(&tm, fsec, &tz, &tzn, USE_XSD_DATES, buf);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user