1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-17 06:41:24 +03:00

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

text_time(), and text_timetz().  7.4-vintage bug found by Greg Stark.
This commit is contained in:
Tom Lane 2007-06-02 16:41:41 +00:00
parent 20c031eb8a
commit 517b078d0e

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.93.2.3 2005/05/26 02:14:31 neilc Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.93.2.4 2007/06/02 16:41:41 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -523,7 +523,8 @@ text_date(PG_FUNCTION_ARGS)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_DATETIME_FORMAT), (errcode(ERRCODE_INVALID_DATETIME_FORMAT),
errmsg("invalid input syntax for type date: \"%s\"", errmsg("invalid input syntax for type date: \"%s\"",
VARDATA(str)))); DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(str))))));
sp = VARDATA(str); sp = VARDATA(str);
dp = dstr; dp = dstr;
@ -1249,7 +1250,8 @@ text_time(PG_FUNCTION_ARGS)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_DATETIME_FORMAT), (errcode(ERRCODE_INVALID_DATETIME_FORMAT),
errmsg("invalid input syntax for type time: \"%s\"", errmsg("invalid input syntax for type time: \"%s\"",
VARDATA(str)))); DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(str))))));
sp = VARDATA(str); sp = VARDATA(str);
dp = dstr; dp = dstr;
@ -2017,8 +2019,9 @@ text_timetz(PG_FUNCTION_ARGS)
if (VARSIZE(str) - VARHDRSZ > MAXDATELEN) if (VARSIZE(str) - VARHDRSZ > MAXDATELEN)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_DATETIME_FORMAT), (errcode(ERRCODE_INVALID_DATETIME_FORMAT),
errmsg("invalid input syntax for type time with time zone: \"%s\"", errmsg("invalid input syntax for type time with time zone: \"%s\"",
VARDATA(str)))); DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(str))))));
sp = VARDATA(str); sp = VARDATA(str);
dp = dstr; dp = dstr;