Re: So what's an "empty" array anyway? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: So what's an "empty" array anyway?
Date
Msg-id 603c8f070811120922k4ce6aebar2557c4268c2ea1aa@mail.gmail.com
Whole thread Raw
In response to Re: So what's an "empty" array anyway?  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
>> I think it's actually more correct to say that {} has an undefined
>> number of dimensions.
>
> That is your opinion, but not my argument above.

I'm aware of that.  I believe that the semantics of array operations
should carry more weight than a count of curly braces, but certainly
you don't have to agree.

>> But {}, and ONLY {}, can be concatenated with an array of any number
>> of dimensions.
>
> Which doesn't necessarily make much sense ...

Well, we could change it, which would render the argument about the
current semantics of {} moot.  The obvious thing to do would be create
separate empty arrays of dimensions 1, 2, 3, 4, 5, and 6, say
'{}'::int[], '{{}}'::int[], etc.  This would break backward
compatibility for people using multi-dimensional arrays, but that
might not be that many people.  (Dunno.)

Alternatively, we could make separate types int[], int[][], int[][][],
etc.   Then '{}'::int[] would be an empty one-dimensional array,
'{}'::int[][] would be an empty two-dimensional array, etc.

...Robert


pgsql-hackers by date:

Previous
From: Andrew Chernow
Date:
Subject: Re: libpq-events windows gotcha
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] Very slow queries w/ NOT IN preparation (seems like a bug, test case)