Re: gen_guc_tables.pl: Validate required GUC fields before code generation

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: gen_guc_tables.pl: Validate required GUC fields before code generation
Date: 2025-11-19 08:33:46
Message-ID: a6381f56-c8d2-4121-8438-0479aa891419@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I find the data structures that you have constructed here barely
understandable:

my %required_by_type = (
int => [qw(min max)],
real => [qw(min max)],
enum => [qw(options)],
);

for my $f (@required_common, @{ $required_by_type{$entry->{type} //
''} // [] }) {

[qw(min max)] is an array inside an array reference? I think? Do we
need two levels of nesting?

I think this // notation is unnecessarily confusing, and why do we need
two of them. I thought your first patch

+ bool => [], # no extra required fields
+ string => [], # no extra required fields

was clearer. And that way, we also check that the field type is one of
the ones we support.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message BharatDB 2025-11-19 09:08:37 Re: BUG #19095: Test if function exit() is used fail when linked static
Previous Message Zhijie Hou (Fujitsu) 2025-11-19 08:23:56 RE: Newly created replication slot may be invalidated by checkpoint