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

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Allow zero-dimensional (ie, empty) arrays in contrib/ltree
Date: 2010-02-24 18:02:36
Message-ID: 20100224180236.B57D87541D0@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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_3_STABLE

Modified Files:
--------------
pgsql/contrib/ltree:
_ltree_gist.c (r1.22 -> r1.22.2.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/_ltree_gist.c?r1=1.22&r2=1.22.2.1)
_ltree_op.c (r1.10 -> r1.10.2.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/_ltree_op.c?r1=1.10&r2=1.10.2.1)
lquery_op.c (r1.11 -> r1.11.4.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/lquery_op.c?r1=1.11&r2=1.11.4.1)
ltree_gist.c (r1.22 -> r1.22.2.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/ltree_gist.c?r1=1.22&r2=1.22.2.1)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-02-24 18:14:11 Re: pgsql: Revert removal of pre-7.4 documenation behavior mentions.
Previous Message Tom Lane 2010-02-24 18:02:30 pgsql: Allow zero-dimensional (ie, empty) arrays in contrib/ltree