mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Use array_contains_nulls instead of ARR_HASNULL on user-supplied arrays.
This applies the fix for bug #5784 to remaining places where we wish to reject nulls in user-supplied arrays. In all these places, there's no reason not to allow a null bitmap to be present, so long as none of the current elements are actually null. I did not change some other places where we are looking at system catalog entries or aggregate transition values, as the presence of a null bitmap in such an array would be suspicious.
This commit is contained in:
@ -4700,7 +4700,7 @@ array_fill_internal(ArrayType *dims, ArrayType *lbs,
|
||||
errmsg("wrong range of array subscripts"),
|
||||
errdetail("Lower bound of dimension array must be one.")));
|
||||
|
||||
if (ARR_HASNULL(dims))
|
||||
if (array_contains_nulls(dims))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
|
||||
errmsg("dimension values cannot be null")));
|
||||
@ -4732,7 +4732,7 @@ array_fill_internal(ArrayType *dims, ArrayType *lbs,
|
||||
errmsg("wrong range of array subscripts"),
|
||||
errdetail("Lower bound of dimension array must be one.")));
|
||||
|
||||
if (ARR_HASNULL(lbs))
|
||||
if (array_contains_nulls(lbs))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
|
||||
errmsg("dimension values cannot be null")));
|
||||
|
@ -213,7 +213,7 @@ ArrayGetIntegerTypmods(ArrayType *arr, int *n)
|
||||
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
|
||||
errmsg("typmod array must be one-dimensional")));
|
||||
|
||||
if (ARR_HASNULL(arr))
|
||||
if (array_contains_nulls(arr))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
|
||||
errmsg("typmod array must not contain nulls")));
|
||||
|
@ -408,7 +408,7 @@ getWeights(ArrayType *win)
|
||||
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
|
||||
errmsg("array of weight is too short")));
|
||||
|
||||
if (ARR_HASNULL(win))
|
||||
if (array_contains_nulls(win))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
|
||||
errmsg("array of weight must not contain nulls")));
|
||||
|
Reference in New Issue
Block a user