1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Add defenses against nulls-in-arrays to contrib/ltree. Possibly it'd

be useful to actually do something with nulls, rather than reject them,
but I'll just close the hole for now.
This commit is contained in:
Tom Lane
2005-11-19 02:08:45 +00:00
parent 1e9a1a70ad
commit 25c00833cb
4 changed files with 33 additions and 0 deletions

View File

@ -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)
{