Re: Generate GUC tables from .dat file
John Naylor <johncnaylorls@gmail.com>
From: John Naylor <johncnaylorls@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-08-26T23:38:50Z
Lists: 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
Commits
-
Ensure guc_tables.o's dependency on guc_tables.inc.c is known.
- aadbcc40bc24 19 (unreleased) landed
-
Clean up newly added guc_tables.inc.c
- f0478149c34d 19 (unreleased) landed
-
Generate GUC tables from .dat file
- 63599896545c 19 (unreleased) landed
-
Formatting cleanup of guc_tables.c
- 878656dbde0d 19 (unreleased) landed