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

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: So what's an "empty" array anyway?
Date: 2008-11-12 17:22:47
Message-ID: 603c8f070811120922k4ce6aebar2557c4268c2ea1aa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

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