The distinction between the standard representation of '{}' as an array
with zero dimensions and nonstandard representations as a 1-dimensional
array with zero elements has come up in a couple of contexts on the IRC
channel recently.
First is contrib/intarray, _AGAIN_ (see past bugs such as #7730):
select array_dims(('{1,2}'::integer[] & '{3}'));array_dims
------------[1:0]
(1 row)
regression=# select ('{1,2}'::integer[] & '{3}') = '{}';?column?
----------f
(1 row)
Worse, the fact that the fix for #7730 (commit c155f654) only did a
very partial job means that it's now inconsistent:
regression=# select (a - b), (a & c), (a - b) = (a & c)from (values (array[1,2],array[1,2],array[3])) v(a,b,c);?column?
|?column? | ?column?
----------+----------+----------{} | {} | f
(1 row)
I plan to fix this one properly, unless anyone has any objections.
Second is aclitem[], past bug #8395 which was not really resolved; empty
ACLs are actually 1-dim arrays of length 0, and all the ACL functions
insist on that, which means that you can't call aclexplode('{}') for
example:
https://www.postgresql.org/message-id/flat/CA%2BTgmoZdDpTJDUVsgzRhoCctidUqLDyO8bdYwgLD5p8DwHtMcQ%40mail.gmail.com
It's much less clear what to do about this one. Thoughts?
--
Andrew (irc:RhodiumToad)