agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Declare variable-length catalog columns as [] rather than [1]
Date: Fri, 25 Sep 2026 06:02:43 +0000
Message-ID: <E1x9z19-00000001BBb-0bxE@gemulon.postgresql.org> (raw)
Declare variable-length catalog columns as [] rather than [1]
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. But to help developers
transition, it still recognizes the old style and gives an explicit
error message. (Otherwise it would produce some garbage output and
give confusing errors later.)
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/963b2109-833c-4e93-bdb1-546741d893f4%40eisentraut.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/16a104073d012ac2c70e9d233dc5e76f71455035
Modified Files
--------------
src/backend/catalog/Catalog.pm | 16 ++++++++++++----
src/include/catalog/pg_attribute.h | 6 +++---
src/include/catalog/pg_class.h | 4 ++--
src/include/catalog/pg_constraint.h | 14 +++++++-------
src/include/catalog/pg_database.h | 2 +-
src/include/catalog/pg_db_role_setting.h | 2 +-
src/include/catalog/pg_default_acl.h | 4 ++--
src/include/catalog/pg_event_trigger.h | 2 +-
src/include/catalog/pg_extension.h | 4 ++--
src/include/catalog/pg_foreign_data_wrapper.h | 4 ++--
src/include/catalog/pg_foreign_server.h | 4 ++--
src/include/catalog/pg_foreign_table.h | 2 +-
src/include/catalog/pg_init_privs.h | 2 +-
src/include/catalog/pg_language.h | 2 +-
src/include/catalog/pg_largeobject_metadata.h | 2 +-
src/include/catalog/pg_namespace.h | 2 +-
src/include/catalog/pg_parameter_acl.h | 2 +-
src/include/catalog/pg_policy.h | 2 +-
src/include/catalog/pg_proc.h | 12 ++++++------
src/include/catalog/pg_statistic.h | 10 +++++-----
src/include/catalog/pg_statistic_ext.h | 2 +-
src/include/catalog/pg_statistic_ext_data.h | 2 +-
src/include/catalog/pg_subscription.h | 2 +-
src/include/catalog/pg_tablespace.h | 4 ++--
src/include/catalog/pg_type.h | 2 +-
src/include/catalog/pg_user_mapping.h | 2 +-
26 files changed, 60 insertions(+), 52 deletions(-)
Message-ID: <E1x9z19-00000001BBb-0bxE@gemulon.postgresql.org>
Permalink: ../E1x9z19-00000001BBb-0bxE@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x9z19-00000001BBb-0bxE@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Declare variable-length catalog columns as [] rather than [1]
In-Reply-To: <E1x9z19-00000001BBb-0bxE@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox