pgsql: gen_guc_tables.pl: Validate required GUC fields before code gene

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: gen_guc_tables.pl: Validate required GUC fields before code gene
Date: 2025-11-25 15:59:19
Message-ID: E1vNvRm-001Mcu-2c@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

gen_guc_tables.pl: Validate required GUC fields before code generation

Previously, gen_guc_tables.pl would emit "Use of uninitialized value"
warnings if required fields were missing in guc_parameters.dat (for
example, when an integer or real GUC omitted the 'max' value). The
resulting error messages were unclear and did not identify which GUC
entry was problematic.

Add explicit validation of required fields depending on the parameter
type, and fail with a clear and specific message such as:

guc_parameters.dat:1909: error: entry "max_index_keys" of type "int" is missing required field "max"

No changes to generated guc_tables.c.

Author: Chao Li <lic(at)highgo(dot)com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Reviewed-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2%3DoP4LgHi771_OKhPPUS7B-CTqCs%3D%3DuQcNXWrwBoAm5Vg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7169c0b96bb8929c939c8e96a52b42571085efe9

Modified Files
--------------
src/backend/utils/misc/gen_guc_tables.pl | 48 ++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2025-11-25 16:25:09 Re: pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent
Previous Message Nathan Bossart 2025-11-25 15:50:16 Re: pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent