diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c
index 16331524321a89676ab65539b8c8e7fbd7f29d45..4a207ccb9880a307d69e6d43ca38beae21661751 100644
--- a/contrib/cube/cube.c
+++ b/contrib/cube/cube.c
@@ -187,7 +187,7 @@ cube_a_f8_f8(PG_FUNCTION_ARGS)
 	double	   *dur,
 			   *dll;
 
-	if (ARR_HASNULL(ur) || ARR_HASNULL(ll))
+	if (array_contains_nulls(ur) || array_contains_nulls(ll))
 		ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
 				 errmsg("cannot work with arrays containing NULLs")));
@@ -228,7 +228,7 @@ cube_a_f8(PG_FUNCTION_ARGS)
 	int			size;
 	double	   *dur;
 
-	if (ARR_HASNULL(ur))
+	if (array_contains_nulls(ur))
 		ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
 				 errmsg("cannot work with arrays containing NULLs")));
@@ -262,7 +262,7 @@ cube_subset(PG_FUNCTION_ARGS)
 				i;
 	int		   *dx;
 
-	if (ARR_HASNULL(idx))
+	if (array_contains_nulls(idx))
 		ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
 				 errmsg("cannot work with arrays containing NULLs")));
diff --git a/contrib/ltree/_ltree_gist.c b/contrib/ltree/_ltree_gist.c
index f221c2de5434a18fb1864494567fcee288d2e8f2..c1f509ed8b18fc2da7fa37757d61ad93867d6e12 100644
--- a/contrib/ltree/_ltree_gist.c
+++ b/contrib/ltree/_ltree_gist.c
@@ -92,7 +92,7 @@ _ltree_compress(PG_FUNCTION_ARGS)
 			ereport(ERROR,
 					(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
 					 errmsg("array must be one-dimensional")));
-		if (ARR_HASNULL(val))
+		if (array_contains_nulls(val))
 			ereport(ERROR,
 					(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
 					 errmsg("array must not contain nulls")));
@@ -538,7 +538,7 @@ _arrq_cons(ltree_gist *key, ArrayType *_query)
 		ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
 				 errmsg("array must be one-dimensional")));
-	if (ARR_HASNULL(_query))
+	if (array_contains_nulls(_query))
 		ereport(ERROR,
 				(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
 				 errmsg("array must not contain nulls")));
diff --git a/contrib/ltree/_ltree_op.c b/contrib/ltree/_ltree_op.c
index 096a748c51375ee2d424e3bbfddf85268c011200..f4f0451fd88b4bbc6b26e8f0cac3e1a4790c726e 100644
--- a/contrib/ltree/_ltree_op.c
+++ b/contrib/ltree/_ltree_op.c
@@ -52,7 +52,7 @@ array_iterator(ArrayType *la, PGCALL2 callback, void *param, ltree **found)
 		ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
 				 errmsg("array must be one-dimensional")));
-	if (ARR_HASNULL(la))
+	if (array_contains_nulls(la))
 		ereport(ERROR,
 				(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
 				 errmsg("array must not contain nulls")));
@@ -152,7 +152,7 @@ _lt_q_regex(PG_FUNCTION_ARGS)
 		ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
 				 errmsg("array must be one-dimensional")));
-	if (ARR_HASNULL(_query))
+	if (array_contains_nulls(_query))
 		ereport(ERROR,
 				(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
 				 errmsg("array must not contain nulls")));
@@ -310,7 +310,7 @@ _lca(PG_FUNCTION_ARGS)
 		ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
 				 errmsg("array must be one-dimensional")));
-	if (ARR_HASNULL(la))
+	if (array_contains_nulls(la))
 		ereport(ERROR,
 				(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
 				 errmsg("array must not contain nulls")));
diff --git a/contrib/ltree/lquery_op.c b/contrib/ltree/lquery_op.c
index 1fbed78157ae9264bac52a2b8b9c170407697db8..fe9ecb118ae0d0c98faf89fb5a64f86fee64af78 100644
--- a/contrib/ltree/lquery_op.c
+++ b/contrib/ltree/lquery_op.c
@@ -348,7 +348,7 @@ lt_q_regex(PG_FUNCTION_ARGS)
 		ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
 				 errmsg("array must be one-dimensional")));
-	if (ARR_HASNULL(_query))
+	if (array_contains_nulls(_query))
 		ereport(ERROR,
 				(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
 				 errmsg("array must not contain nulls")));
diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c
index 47a85bbabc2002f60a342b6ce001bc8420c79720..26c34753dcf93ad22d111c186c030cf346b910f3 100644
--- a/contrib/ltree/ltree_gist.c
+++ b/contrib/ltree/ltree_gist.c
@@ -606,7 +606,7 @@ arrq_cons(ltree_gist *key, ArrayType *_query)
 		ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
 				 errmsg("array must be one-dimensional")));
-	if (ARR_HASNULL(_query))
+	if (array_contains_nulls(_query))
 		ereport(ERROR,
 				(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
 				 errmsg("array must not contain nulls")));
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index a1bcbe687fdc13e44917ad58cbc790f612090d6c..1be96517df946f24a7b191800a35d7719862549c 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -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")));
diff --git a/src/backend/utils/adt/arrayutils.c b/src/backend/utils/adt/arrayutils.c
index e3f116975d88a5519440cc34ee87b3e3d30915a2..af7359ca4e329446a24208669bafdc4a78ba5cdc 100644
--- a/src/backend/utils/adt/arrayutils.c
+++ b/src/backend/utils/adt/arrayutils.c
@@ -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")));
diff --git a/src/backend/utils/adt/tsrank.c b/src/backend/utils/adt/tsrank.c
index 65823bd705229a9cfda8d9ea549584faccbe68d8..8f5941c14769b85ac4e5de4f315ba0fa9dbec163 100644
--- a/src/backend/utils/adt/tsrank.c
+++ b/src/backend/utils/adt/tsrank.c
@@ -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")));