From: Tom Lane Date: Sat, 2 Jun 2007 16:41:41 +0000 (+0000) Subject: Fix erroneous error reporting for overlength input in text_date(), X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=083f3b62e2271ade9a3e1a1feedcc83f177ff324;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 14dca6aa8c..1910ba5f98 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -523,8 +523,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++) @@ -1249,7 +1250,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; @@ -2017,8 +2019,9 @@ text_timetz(PG_FUNCTION_ARGS) if (VARSIZE(str) - VARHDRSZ > MAXDATELEN) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("invalid input syntax for type time with time zone: \"%s\"", - VARDATA(str)))); + errmsg("invalid input syntax for type time with time zone: \"%s\"", + DatumGetCString(DirectFunctionCall1(textout, + PointerGetDatum(str)))))); sp = VARDATA(str); dp = dstr;