| From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Declare variable-length catalog columns as [] rather than [1] |
| Date: | 2026-09-22 08:00:01 |
| Message-ID: | 2c7e5bf0-45d5-415a-b953-5ebd4d03119c@iki.fi |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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 the C compiler, and
> this was also before flexible array members were universally available,
> so this was just a convenient workaround to make this compile. But
> these reasons are long gone, and the "1" is now just a confusing relic.
> Change this to
>
> text attoptions[];
>
> which more intuitively reflects the actual nature of these fields (while
> still being syntactically valid but semantically invalid C code).
>
> Catalog.pm could already parse both spellings, but no existing code used
> bare []. To enforce future consistency, it is changed to no longer
> permit digits between the brackets.
+1, looks good to me.
- Heikki
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-09-22 08:00:44 | Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring |
| Previous Message | ZizhuanLiu X-MAN | 2026-09-22 07:59:46 | Re: Optimize MCV stats for sortable types and utilize sorted-order properties |