Re: Declare variable-length catalog columns as [] rather than [1] - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Declare variable-length catalog columns as [] rather than [1]
Date
Msg-id E29DAFBC-60AE-4686-8C6A-6AAD8A275790@yesql.se
Whole thread
In response to Re: Declare variable-length catalog columns as [] rather than [1]  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
> On 22 Sep 2026, at 10:00, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>
> On 22/09/2026 10:47, Peter Eisentraut wrote:
>> Variable-length catalog columns have been declared like
>>     text attoptions[1];
>> but that "1" has always been a fiction.  Before the use of #ifdef CATALOG_VARLEN, these declarations were visible to
theC compiler, and this was also before flexible array members were universally available, so this was just a
convenientworkaround to make this compile.  But these reasons are long gone, and the "1" is now just a confusing relic.
Changethis to 
>>     text attoptions[];
>> which more intuitively reflects the actual nature of these fields (while still being syntactically valid but
semanticallyinvalid C code). 
>> Catalog.pm could already parse both spellings, but no existing code used bare [].  To enforce future consistency, it
ischanged to no longer permit digits between the brackets. 
>
> +1, looks good to me.

Agreed, that '1' has confused me more than once so glad to see it cleaned up.

--
Daniel Gustafsson




pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: sequencesync worker race with REFRESH SEQUENCES
Next
From: Chao Li
Date:
Subject: Re: WAL segment file descriptor leak on read errors can PANIC the server