From 3ec9fb893e61939bb7cbee96dd787c644c3b1d22 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 3 Jul 2001 16:52:48 +0000 Subject: [PATCH] Add a little more error checking and reporting to readDatum(). --- src/backend/nodes/readfuncs.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 2f0dec048b..b3e3105da6 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -8,7 +8,7 @@ * * * 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 * Most of the read functions for plan nodes are tested. (In fact, they @@ -2052,7 +2052,11 @@ readDatum(bool typbyval) token = pg_strtok(&tokenLength); 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) { @@ -2080,9 +2084,10 @@ readDatum(bool typbyval) res = PointerGetDatum(s); } - token = pg_strtok(&tokenLength); /* skip the ']' */ + token = pg_strtok(&tokenLength); /* read the ']' */ 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); return res; -- 2.11.0