From: Tom Lane Date: Sat, 2 Jun 2007 16:41:23 +0000 (+0000) Subject: Fix erroneous error reporting for overlength input in text_date(), X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=6bd7c0eb2d44e8c639adfb603a86d8adcbe7cc8a;p=users%2Fbernd%2Fpostgres.git Fix erroneous error reporting for overlength input in text_date(), text_time(), and text_timetz(). 7.4-vintage bug found by Greg Stark. --- diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index 68ed433a1f..0916033f03 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -864,8 +864,9 @@ text_date(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), errmsg("invalid input syntax for type date: \"%s\"", - VARDATA(str)))); - + DatumGetCString(DirectFunctionCall1(textout, + PointerGetDatum(str)))))); + sp = VARDATA(str); dp = dstr; for (i = 0; i < (VARSIZE(str) - VARHDRSZ); i++) @@ -1591,7 +1592,8 @@ text_time(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), errmsg("invalid input syntax for type time: \"%s\"", - VARDATA(str)))); + DatumGetCString(DirectFunctionCall1(textout, + PointerGetDatum(str)))))); sp = VARDATA(str); dp = dstr; @@ -2360,7 +2362,8 @@ text_timetz(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), errmsg("invalid input syntax for type time with time zone: \"%s\"", - VARDATA(str)))); + DatumGetCString(DirectFunctionCall1(textout, + PointerGetDatum(str)))))); sp = VARDATA(str); dp = dstr;