]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix wrong error reports in 'number of array dimensions exceeds the
authorItagaki Takahiro <itagaki.takahiro@gmail.com>
Tue, 1 Feb 2011 06:48:08 +0000 (15:48 +0900)
committerItagaki Takahiro <itagaki.takahiro@gmail.com>
Tue, 1 Feb 2011 06:48:42 +0000 (15:48 +0900)
maximum allowed' messages, that have reported one-less dimensions.

Alexey Klyukin

src/backend/executor/execQual.c
src/backend/utils/adt/arrayfuncs.c

index 4b177d253297af454aa592cfaa7084be2913b537..9cbc7e8f3ee245dc50d888e8a1b25c5e7d3d40e7 100644 (file)
@@ -266,7 +266,7 @@ ExecEvalArrayRef(ArrayRefExprState *astate,
                        ereport(ERROR,
                                        (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                                         errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
-                                                       i, MAXDIM)));
+                                                       i + 1, MAXDIM)));
 
                upper.indx[i++] = DatumGetInt32(ExecEvalExpr(eltstate,
                                                                                                         econtext,
@@ -294,7 +294,7 @@ ExecEvalArrayRef(ArrayRefExprState *astate,
                                ereport(ERROR,
                                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                                                 errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
-                                                               i, MAXDIM)));
+                                                               j + 1, MAXDIM)));
 
                        lower.indx[j++] = DatumGetInt32(ExecEvalExpr(eltstate,
                                                                                                                 econtext,
index 536c4a7ea4a571f4c7bba6276df5196787bd0c8b..21335ce5665cd908fdea46768ef67886cf0b9b8c 100644 (file)
@@ -200,7 +200,7 @@ array_in(PG_FUNCTION_ARGS)
                        ereport(ERROR,
                                        (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                                         errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
-                                                       ndim, MAXDIM)));
+                                                       ndim + 1, MAXDIM)));
 
                for (q = p; isdigit((unsigned char) *q) || (*q == '-') || (*q == '+'); q++);
                if (q == p)                             /* no digits? */
@@ -452,7 +452,7 @@ ArrayCount(const char *str, int *dim, char typdelim)
                                                        ereport(ERROR,
                                                                        (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                                                                         errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
-                                                                                       nest_level, MAXDIM)));
+                                                                                       nest_level + 1, MAXDIM)));
                                                temp[nest_level] = 0;
                                                nest_level++;
                                                if (ndim < nest_level)