Re: Generate GUC tables from .dat file - Mailing list pgsql-hackers

From John Naylor
Subject Re: Generate GUC tables from .dat file
Date
Msg-id CANWCAZaP-B0sfMo6546Bhm13OjuOeLZ1=H8Q0+d-6AKYqyczvA@mail.gmail.com
Whole thread Raw
In response to Re: Generate GUC tables from .dat file  (Peter Eisentraut <peter@eisentraut.org>)
List pgsql-hackers
On Mon, Aug 25, 2025 at 4:36 PM Peter Eisentraut <peter@eisentraut.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



pgsql-hackers by date:

Previous
From: Sami Imseih
Date:
Subject: Re: Improve LWLock tranche name visibility across backends
Next
From: Noah Misch
Date:
Subject: Re: Buffer locking is special (hints, checksums, AIO writes)