aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/arrayfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-11-17 11:29:42 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2023-11-17 11:29:46 -0500
commit8d5573b92e66075c20f327d93d46a24095739a58 (patch)
treedc8c81e72f8fe0e766d12d7bf09c38bbca2f4b84 /src/backend/utils/adt/arrayfuncs.c
parent284cbaea7c4b89ce8685a148baeaf1d7896a900e (diff)
downloadpostgresql-8d5573b92e66075c20f327d93d46a24095739a58.tar.gz
postgresql-8d5573b92e66075c20f327d93d46a24095739a58.zip
Don't specify number of dimensions in cases where we don't know it.
A few places in array_in() and plperl would report a misleading value (always MAXDIM+1) for the number of dimensions in the input, because we'd error out as soon as that was clearly too large rather than scanning the entire input. There doesn't seem to be much value in offering the true number, at least not enough to justify the extra complication involved in trying to get it. So just remove that parenthetical remark. We already have other places that do it like that, anyway. Per suggestions from Alexander Lakhin and Heikki Linnakangas. Discussion: https://postgr.es/m/2794005.1683042087@sss.pgh.pa.us
Diffstat (limited to 'src/backend/utils/adt/arrayfuncs.c')
-rw-r--r--src/backend/utils/adt/arrayfuncs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index d71967de01f..631012a0f28 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -429,8 +429,8 @@ ReadArrayDimensions(char **srcptr, int *ndim_p, int *dim, int *lBound,
if (ndim >= MAXDIM)
ereturn(escontext, false,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
- ndim + 1, MAXDIM)));
+ errmsg("number of array dimensions exceeds the maximum allowed (%d)",
+ MAXDIM)));
q = p;
if (!ReadDimensionInt(&p, &i, origStr, escontext))
@@ -641,8 +641,8 @@ ReadArrayStr(char **srcptr,
if (nest_level >= MAXDIM)
ereturn(escontext, false,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",
- nest_level + 1, MAXDIM)));
+ errmsg("number of array dimensions exceeds the maximum allowed (%d)",
+ MAXDIM)));
nelems[nest_level] = 0;
nest_level++;