gen_guc_tables improvements

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: gen_guc_tables improvements
Date: 2026-03-15 12:18:53
Message-ID: CAN4CZFP=3xUoXb9jpn5OWwicg+rbyrca8-tVmgJsQAa4+OExkw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

While reviewing a patch, I noticed a typo in guc_params.dat. The code
compiled and seemingly worked, and I was very surprised that the
generator script didn't catch the mistake.

I looked into it, and I found several missing checks in
gen_guc_tables. I attached fixes for 4 that I think would definitely
improve the script (for now as separate patches, so it is easy to
select only some of them):

* 0001 fixes the issue that started this, it validates the allowed
field names, preventing typos in their names
* 0002 goes a step further and validates that fields specific to some
types can only appear for those types
* 0003 just improves the error reported by duplicate names, previously
this was confusing (it referred to incorrect ordering)
* 0004 adds basic checks about allowed characters in GUC names

I was also thinking about adding validations for the enum/define
values (config group, flags, guc context), but that requires a
somewhat fragile extraction code, and I decided to leave that out for
now.

What do you think about these changes?

Attachment Content-Type Size
0001-gen_guc_tables-reject-unrecognized-field-names-in-gu.patch application/octet-stream 1.5 KB
0002-gen_guc_tables-reject-type-inappropriate-fields-in-g.patch application/octet-stream 2.6 KB
0003-gen_guc_tables-report-duplicate-entry-names-distinct.patch application/octet-stream 1.5 KB
0004-gen_guc_tables-validate-GUC-name-format.patch application/octet-stream 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-03-15 12:25:34 Re: Skipping schema changes in publication
Previous Message Álvaro Herrera 2026-03-15 12:11:00 Re: bug: pg_dumpall with --data-only and --clean options is giving an error after some dump