Declare variable-length catalog columns as [] rather than [1]

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Declare variable-length catalog columns as [] rather than [1]
Date: 2026-09-22 07:47:35
Message-ID: 963b2109-833c-4e93-bdb1-546741d893f4@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

(Obviously, catalog definitions are not backpatched, so this shouldn't
create any new maintenance burden.)

Attachment Content-Type Size
0001-Declare-variable-length-catalog-columns-as-rather-th.patch text/plain 20.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2026-09-22 07:51:51 Re: logical decoding: skip unnecessary snapshot distribution.
Previous Message Andrew Bille 2026-09-22 07:45:26 Re: Windows locales and tests portability