Re: Generate GUC tables from .dat file

From: John Naylor <johncnaylorls(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Generate GUC tables from .dat file
Date: 2025-08-26 23:38:50
Message-ID: CANWCAZaP-B0sfMo6546Bhm13OjuOeLZ1=H8Q0+d-6AKYqyczvA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 25, 2025 at 4:36 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> Here is an updated patch with the remaining comments carried over. I'm
> not sure how I lost these. I also added some more comments to the Perl
> script and have it print the usual boilerplate into the header. And I
> added some .gitignore entries. This seems pretty complete to me now.

Looks good overall. Some style suggestions:

+ print $ofh qq[\t\t]
+ . ($entry->{check_hook} || 'NULL') . qq[, ]
+ . ($entry->{assign_hook} || 'NULL') . qq[, ]
+ . ($entry->{show_hook} || 'NULL') . qq[\n];

The string construction in this script is rather verbose. I'd do something like:

printf $ofh "\t\t%s, %s, %s\n",
$entry->{check_hook} || 'NULL',
$entry->{assign_hook} || 'NULL',
$entry->{show_hook} || 'NULL';

+ print $ofh "#ifdef " . $entry->{ifdef} . "\n" if $entry->{ifdef};

Likewise:

print $ofh "#ifdef $entry->{ifdef}\n" if $entry->{ifdef};

+ print $ofh qq[\t\t\tgettext_noop("]
+ . escape($entry->{long_desc}) . qq[")];

If the "escape" function was a "quote" function that also did its own
escaping, there'd be less need for these literal quotes, and so maybe
no need for the "qq[]"'s here.

+ boot_val => '""',

+ boot_val => '"ISO, MDY"',

A "quote" function could also insert these for config_string GUCs.

--
John Naylor
Amazon Web Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2025-08-27 00:14:49 Re: Buffer locking is special (hints, checksums, AIO writes)
Previous Message Sami Imseih 2025-08-26 22:50:34 Re: Improve LWLock tranche name visibility across backends