mirror of https://github.com/postgres/postgres
Add missing check for too-few-inputs when replacing a zero-dimensional
array.
This commit is contained in:
parent
327d86ca99
commit
32af13f03d
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.103 2004/06/06 00:41:27 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.104 2004/06/08 20:28:21 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -1837,6 +1837,12 @@ array_set_slice(ArrayType *array,
|
|||
lb[i] = lowerIndx[i];
|
||||
}
|
||||
|
||||
/* complain if too few source items; we ignore extras, however */
|
||||
if (nelems < ArrayGetNItems(nSubscripts, dim))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
|
||||
errmsg("source array too small")));
|
||||
|
||||
return construct_md_array(dvalues, nSubscripts, dim, lb, elmtype,
|
||||
elmlen, elmbyval, elmalign);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue