Add a little more error checking and reporting to readDatum().
This commit is contained in:
parent
31c1fea6a8
commit
3ec9fb893e
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.111 2001/06/19 22:39:11 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.112 2001/07/03 16:52:48 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Most of the read functions for plan nodes are tested. (In fact, they
|
* Most of the read functions for plan nodes are tested. (In fact, they
|
||||||
@ -2052,7 +2052,11 @@ readDatum(bool typbyval)
|
|||||||
token = pg_strtok(&tokenLength);
|
token = pg_strtok(&tokenLength);
|
||||||
length = atoui(token);
|
length = atoui(token);
|
||||||
|
|
||||||
token = pg_strtok(&tokenLength); /* skip the '[' */
|
token = pg_strtok(&tokenLength); /* read the '[' */
|
||||||
|
if (token == NULL || token[0] != '[')
|
||||||
|
elog(ERROR, "readDatum: expected '%s', got '%s'; length = %lu",
|
||||||
|
"[", token ? (const char *) token : "[NULL]",
|
||||||
|
(unsigned long) length);
|
||||||
|
|
||||||
if (typbyval)
|
if (typbyval)
|
||||||
{
|
{
|
||||||
@ -2080,9 +2084,10 @@ readDatum(bool typbyval)
|
|||||||
res = PointerGetDatum(s);
|
res = PointerGetDatum(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
token = pg_strtok(&tokenLength); /* skip the ']' */
|
token = pg_strtok(&tokenLength); /* read the ']' */
|
||||||
if (token == NULL || token[0] != ']')
|
if (token == NULL || token[0] != ']')
|
||||||
elog(ERROR, "readDatum: ']' expected, length = %lu",
|
elog(ERROR, "readDatum: expected '%s', got '%s'; length = %lu",
|
||||||
|
"]", token ? (const char *) token : "[NULL]",
|
||||||
(unsigned long) length);
|
(unsigned long) length);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user