提交 376ee150 编写于 作者: T Tom Lane

Fix erroneous error reporting for overlength input in text_date(),

text_time(), and text_timetz().  7.4-vintage bug found by Greg Stark.
上级 4e023373
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.130 2007/05/30 19:38:05 neilc Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.131 2007/06/02 16:41:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -918,8 +918,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++)
......@@ -1659,7 +1660,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))))));
len = VARSIZE(str) - VARHDRSZ;
memcpy(dstr, VARDATA(str), len);
......@@ -2443,7 +2445,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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册