Commit 0c707aa4 authored by Itagaki Takahiro's avatar Itagaki Takahiro

Fix wrong error reports in 'number of array dimensions exceeds the

maximum allowed' messages, that have reported one-less dimensions.

Alexey Klyukin
parent 03282bfa
...@@ -296,7 +296,7 @@ ExecEvalArrayRef(ArrayRefExprState *astate, ...@@ -296,7 +296,7 @@ ExecEvalArrayRef(ArrayRefExprState *astate,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)", errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
i, MAXDIM))); i + 1, MAXDIM)));
upper.indx[i++] = DatumGetInt32(ExecEvalExpr(eltstate, upper.indx[i++] = DatumGetInt32(ExecEvalExpr(eltstate,
econtext, econtext,
...@@ -324,7 +324,7 @@ ExecEvalArrayRef(ArrayRefExprState *astate, ...@@ -324,7 +324,7 @@ ExecEvalArrayRef(ArrayRefExprState *astate,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)", errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
i, MAXDIM))); j + 1, MAXDIM)));
lower.indx[j++] = DatumGetInt32(ExecEvalExpr(eltstate, lower.indx[j++] = DatumGetInt32(ExecEvalExpr(eltstate,
econtext, econtext,
......
...@@ -202,7 +202,7 @@ array_in(PG_FUNCTION_ARGS) ...@@ -202,7 +202,7 @@ array_in(PG_FUNCTION_ARGS)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)", 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++); for (q = p; isdigit((unsigned char) *q) || (*q == '-') || (*q == '+'); q++);
if (q == p) /* no digits? */ if (q == p) /* no digits? */
...@@ -481,7 +481,7 @@ ArrayCount(const char *str, int *dim, char typdelim) ...@@ -481,7 +481,7 @@ ArrayCount(const char *str, int *dim, char typdelim)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)", errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
nest_level, MAXDIM))); nest_level + 1, MAXDIM)));
temp[nest_level] = 0; temp[nest_level] = 0;
nest_level++; nest_level++;
if (ndim < nest_level) if (ndim < nest_level)
......
...@@ -3786,7 +3786,7 @@ exec_assign_value(PLpgSQL_execstate *estate, ...@@ -3786,7 +3786,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)", errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
nsubscripts, MAXDIM))); nsubscripts + 1, MAXDIM)));
subscripts[nsubscripts++] = arrayelem->subscript; subscripts[nsubscripts++] = arrayelem->subscript;
target = estate->datums[arrayelem->arrayparentno]; target = estate->datums[arrayelem->arrayparentno];
} while (target->dtype == PLPGSQL_DTYPE_ARRAYELEM); } while (target->dtype == PLPGSQL_DTYPE_ARRAYELEM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment