[HACKERS] Ongoing issues with representation of empty arrays - Mailing list pgsql-hackers

From Andrew Gierth
Subject [HACKERS] Ongoing issues with representation of empty arrays
Date
Msg-id 878tn7x1hn.fsf@news-spur.riddles.org.uk
Whole thread Raw
Responses Re: [HACKERS] Ongoing issues with representation of empty arrays  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [HACKERS] Ongoing issues with representation of empty arrays  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] Ongoing issues with representation of empty arrays  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
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)



pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: [HACKERS] WAL logging problem in 9.4.3?
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] SUBSCRIPTIONS and pg_upgrade