diff --git a/contrib/ltree/_ltree_gist.c b/contrib/ltree/_ltree_gist.c index 0344b6dc13493fcffc73bf269bfc7b68c96b172b..c4623ec020f02bf657ced33233ed520f435118d7 100644 --- a/contrib/ltree/_ltree_gist.c +++ b/contrib/ltree/_ltree_gist.c @@ -76,6 +76,10 @@ _ltree_compress(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), errmsg("array must be one-dimensional"))); + if (ARR_HASNULL(val)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); key = (ltree_gist *) palloc(len); key->len = len; @@ -518,6 +522,10 @@ _arrq_cons(ltree_gist * key, ArrayType *_query) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), errmsg("array must be one-dimensional"))); + if (ARR_HASNULL(_query)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); while (num > 0) { diff --git a/contrib/ltree/_ltree_op.c b/contrib/ltree/_ltree_op.c index 729d19c08292100b3aa536ed73b96bbe9a14f3cd..ff8eec793a644eae571635638aca4c03ed3277ac 100644 --- a/contrib/ltree/_ltree_op.c +++ b/contrib/ltree/_ltree_op.c @@ -47,6 +47,10 @@ 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)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); if (found) *found = NULL; @@ -143,6 +147,10 @@ _lt_q_regex(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), errmsg("array must be one-dimensional"))); + if (ARR_HASNULL(_query)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); while (num > 0) { @@ -293,6 +301,15 @@ _lca(PG_FUNCTION_ARGS) ltree **a, *res; + if (ARR_NDIM(la) != 1) + ereport(ERROR, + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("array must be one-dimensional"))); + if (ARR_HASNULL(la)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); + a = (ltree **) palloc(sizeof(ltree *) * num); while (num > 0) { diff --git a/contrib/ltree/lquery_op.c b/contrib/ltree/lquery_op.c index 54466a5b6beb717f1276c6f9b26ce32e77f5bc06..6d5a937bebba152587a75f368c2a1894c9a51a21 100644 --- a/contrib/ltree/lquery_op.c +++ b/contrib/ltree/lquery_op.c @@ -328,6 +328,10 @@ lt_q_regex(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), errmsg("array must be one-dimensional"))); + if (ARR_HASNULL(_query)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); while (num > 0) { diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c index 2be6449329c71bf0068c7998cb8c400b009bcbe2..9cdbcde886e7a889be9b01d58c9136db333cb7d1 100644 --- a/contrib/ltree/ltree_gist.c +++ b/contrib/ltree/ltree_gist.c @@ -607,6 +607,10 @@ arrq_cons(ltree_gist * key, ArrayType *_query) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), errmsg("array must be one-dimensional"))); + if (ARR_HASNULL(_query)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); while (num > 0) {