pgsql: Allow zero-dimensional (ie, empty) arrays in contrib/ltree - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Allow zero-dimensional (ie, empty) arrays in contrib/ltree
Date
Msg-id 20100224180230.228117541D0@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
Allow zero-dimensional (ie, empty) arrays in contrib/ltree operations.

The main motivation for changing this is bug #4921, in which it's pointed out
that it's no longer safe to apply ltree operations to the result of
ARRAY(SELECT ...) if the sub-select might return no rows.  Before 8.3,
the ARRAY() construct would return NULL, which might or might not be helpful
but at least it wouldn't result in an error.  Now it returns an empty array
which results in a failure for no good reason, since the ltree operations
are all perfectly capable of dealing with zero-element arrays.

As far as I can find, these ltree functions are the only places where zero
array dimensionality is rejected unnecessarily.

Back-patch to 8.3 to prevent behavioral regression of queries that worked
in older releases.

Tags:
----
REL8_4_STABLE

Modified Files:
--------------
    pgsql/contrib/ltree:
        _ltree_gist.c (r1.26 -> r1.26.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/_ltree_gist.c?r1=1.26&r2=1.26.2.1)
        _ltree_op.c (r1.13 -> r1.13.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/_ltree_op.c?r1=1.13&r2=1.13.2.1)
        lquery_op.c (r1.14 -> r1.14.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/lquery_op.c?r1=1.14&r2=1.14.2.1)
        ltree_gist.c (r1.25 -> r1.25.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/ltree_gist.c?r1=1.25&r2=1.25.2.1)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Allow zero-dimensional (ie, empty) arrays in contrib/ltree
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Allow zero-dimensional (ie, empty) arrays in contrib/ltree