gen_guc_tables.pl: Validate required GUC fields before code generation

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: gen_guc_tables.pl: Validate required GUC fields before code generation
Date: 2025-11-10 08:42:00
Message-ID: CAEoWx2=oP4LgHi771_OKhPPUS7B-CTqCs==uQcNXWrwBoAm5Vg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hacker,

While working on the other patch and editing guc_parameters.dat, I
mistakenly deleted a “max” value line, then I got the following error
during build:

```
'/opt/homebrew/bin/perl' ../../../src/backend/utils/misc/gen_guc_tables.pl
../../../src/backend/utils/misc/guc_parameters.dat guc_tables.inc.c
Use of uninitialized value in printf at ../../../src/backend/utils/misc/
gen_guc_tables.pl line 78.
make[2]: *** [guc_tables.inc.c] Error 25
```

The error message is unclear and is not helpful to identify the real issue.

I am not an expert of perl, but I tried to make an enhancement that will
print an error message like:

```
'/opt/homebrew/bin/perl' ../../../src/backend/utils/misc/gen_guc_tables.pl
../../../src/backend/utils/misc/guc_parameters.dat guc_tables.inc.c
error: guc_parameters.data: 'max_index_keys' of type 'int' is missing
required field 'max'
```

I got the “required_common” and “required_by_type” by reading the function
“print_table”.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v1-0001-gen_guc_tables.pl-Validate-required-GUC-fields-be.patch application/octet-stream 2.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-11-10 08:53:45 Re: relfilenode statistics
Previous Message Fujii Masao 2025-11-10 08:39:31 Re: [PATCH] Add hints for invalid binary encoding names in encode/decode functions