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

Alexey Klyukin

src/backend/executor/execQual.c
src/backend/utils/adt/arrayfuncs.c
src/pl/plpgsql/src/pl_exec.c

index 8bc086fc404dd831b26549032897fb60bb970764..5e38c20ca6805f8be18d384cb9ff0c5b6403ef1f 100644 (file)
@@ -296,7 +296,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,
@@ -324,7 +324,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 d5391e8b983a0df4827b03b105272a665345bb89..931c6953cb3cb9b8961aebe5f7d58b2644a076e1 100644 (file)
@@ -202,7 +202,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? */
@@ -481,7 +481,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)
index 3e40945e35d21660897f31eeeebfb33904eca347..b685841d971edeca3f73d7e30fe798c58a81a030 100644 (file)
@@ -3786,7 +3786,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
                                                ereport(ERROR,
                                                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                                                                 errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
-                                                                               nsubscripts, MAXDIM)));
+                                                                               nsubscripts + 1, MAXDIM)));
                                        subscripts[nsubscripts++] = arrayelem->subscript;
                                        target = estate->datums[arrayelem->arrayparentno];
                                } while (target->dtype == PLPGSQL_DTYPE_ARRAYELEM);