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(-)