mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Sort guc_parameters.dat alphabetically by name
The order in this list was previously pretty random and had grown organically over time. This made it unnecessarily cumbersome to maintain these lists, as there was no clear guidelines about where to put new entries. Also, after the merger of the type-specific GUC structs, the list still reflected the previous type-specific super-order. By using alphabetical order, the place for new entries becomes clear, and often related entries will be listed close together. This patch reorders the existing entries in guc_parameters.dat, and it also augments the generation script to error if an entry is found at the wrong place. Note: The order is actually checked after lower-casing, to handle the likes of "DateStyle". Reviewed-by: John Naylor <johncnaylorls@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org
This commit is contained in:
@@ -42,6 +42,7 @@ sub dquote
|
|||||||
sub print_table
|
sub print_table
|
||||||
{
|
{
|
||||||
my ($ofh) = @_;
|
my ($ofh) = @_;
|
||||||
|
my $prev_name = undef;
|
||||||
|
|
||||||
print $ofh "\n\n";
|
print $ofh "\n\n";
|
||||||
print $ofh "struct config_generic ConfigureNames[] =\n";
|
print $ofh "struct config_generic ConfigureNames[] =\n";
|
||||||
@@ -49,6 +50,13 @@ sub print_table
|
|||||||
|
|
||||||
foreach my $entry (@{$parse})
|
foreach my $entry (@{$parse})
|
||||||
{
|
{
|
||||||
|
if (defined($prev_name) && lc($prev_name) ge lc($entry->{name}))
|
||||||
|
{
|
||||||
|
die sprintf(
|
||||||
|
"entries are not in alphabetical order: \"%s\", \"%s\"\n",
|
||||||
|
$prev_name, $entry->{name});
|
||||||
|
}
|
||||||
|
|
||||||
print $ofh "#ifdef $entry->{ifdef}\n" if $entry->{ifdef};
|
print $ofh "#ifdef $entry->{ifdef}\n" if $entry->{ifdef};
|
||||||
print $ofh "\t{\n";
|
print $ofh "\t{\n";
|
||||||
printf $ofh "\t\t.name = %s,\n", dquote($entry->{name});
|
printf $ofh "\t\t.name = %s,\n", dquote($entry->{name});
|
||||||
@@ -80,6 +88,8 @@ sub print_table
|
|||||||
print $ofh "\t},\n";
|
print $ofh "\t},\n";
|
||||||
print $ofh "#endif\n" if $entry->{ifdef};
|
print $ofh "#endif\n" if $entry->{ifdef};
|
||||||
print $ofh "\n";
|
print $ofh "\n";
|
||||||
|
|
||||||
|
$prev_name = $entry->{name};
|
||||||
}
|
}
|
||||||
|
|
||||||
print $ofh "\t/* End-of-list marker */\n";
|
print $ofh "\t/* End-of-list marker */\n";
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user