Re: So what's an "empty" array anyway?

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: So what's an "empty" array anyway?
Date: 2008-10-21 18:39:19
Message-ID: b42b73150810211139p1707b29cpaf3b54716f90c71e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 21, 2008 at 2:23 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Merlin Moncure" <mmoncure(at)gmail(dot)com> writes:
>> ISTM this is the way it should work from SQL level:
>
>> '{}'::int[] empty 1d
>> '{{},{}}'::int[] :: empty 2d
>
> The first one looks okay, but ISTM the second one is not describing
> an "empty" array: the upper dimension is of length 2. In particular
> I think that under your proposal array_dims() would probably yield
> these results:
>
> [1:0]
> [1:2][1:0]
>
> and all of these would be different:
>
> '{{}}'::int[] [1:1][1:0]
> '{{},{}}'::int[] [1:2][1:0]
> '{{},{},{}}'::int[] [1:3][1:0]
>
> Maybe this is okay but it feels a bit weird.

agreed...you're right...and if this flies, you are still restricted to
making empty arrays for 1d only, so in this case I guess that's where
the array should be locked down.

>> If you dump zero dimension arrays, then the problem about what to do
>> with array_dims goes away.
>
> I'm not against dropping zero-dimension arrays ...

yup.

merlin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2008-10-21 19:07:31 Re: [HACKERS] pgsql: SQL 200N -> SQL:2003
Previous Message Decibel! 2008-10-21 18:30:53 Re: Regression in IN( field, field, field ) performance