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:24
Message-ID: 20100224180224.D35B87541D0@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.

Modified Files:
--------------
pgsql/contrib/ltree:
_ltree_gist.c (r1.26 -> r1.27)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/_ltree_gist.c?r1=1.26&r2=1.27)
_ltree_op.c (r1.13 -> r1.14)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/_ltree_op.c?r1=1.13&r2=1.14)
lquery_op.c (r1.14 -> r1.15)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/lquery_op.c?r1=1.14&r2=1.15)
ltree_gist.c (r1.25 -> r1.26)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/ltree/ltree_gist.c?r1=1.25&r2=1.26)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-02-24 18:02:30 pgsql: Allow zero-dimensional (ie, empty) arrays in contrib/ltree
Previous Message Simon Riggs 2010-02-24 17:52:06 Re: Re: [COMMITTERS] pgsql: Move documentation of all recovery.conf option to a new chapter.