Re: BUG #4921: ltree @> ltree[] operator shouldn't fail if ltree[] is empty

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alan Pinstein <apinstein(at)mac(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4921: ltree @> ltree[] operator shouldn't fail if ltree[] is empty
Date: 2010-02-24 16:00:49
Message-ID: 201002241600.o1OG0nX21982@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


Was this ever addressed?

---------------------------------------------------------------------------

Tom Lane wrote:
> "Alan Pinstein" <apinstein(at)mac(dot)com> writes:
> > ... hierarchy @> ARRAY(select hierarchy from
> > feature where description ilike '%pool%this%') ...
>
> > EXPECTED BEHAVIOR:
> > - return 0 rows
>
> > ACTUAL BEHAVIOR:
> > ERROR: array must be one-dimensional
> > Possibly from:
> > https://projects.commandprompt.com/public/replicator/browser/trunk/contrib/ltree/_ltree_op.c?rev=1905 line 46
>
> > NOTES:
> > This query worked in 8.1.x and started failing in 8.3.6 (only 2 versions I
> > tested).
>
> Hmm. ltree has always had that ARR_NDIM == 1 check. I think the reason
> the behavior changed is that ARRAY(SELECT ...) used to return a NULL for
> zero rows, and now it returns an empty (zero-dimensional) array.
>
> I can see two reasonable ways to address this:
>
> * Change the ltree test to reject only ARR_NDIM > 1.
>
> * Drop the ARR_NDIM check altogether, and let it search any sort of
> array.
>
> I'm leaning to #2 myself. However, there are probably other places with
> the same kind of issue, and in some of them it might make more sense to
> reject multidimensional arrays.
>
> regards, tom lane
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
PG East: http://www.enterprisedb.com/community/nav-pg-east-2010.do
+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-02-24 16:00:54 Re: BUG #5345: non-administrator users cannot create databases with special encoding
Previous Message Tom Lane 2010-02-24 15:54:46 Re: BUG #5338: PG_DUMP fails due to invalid adnum value