Re: Generate GUC tables from .dat file

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Generate GUC tables from .dat file
Дата
Msg-id 720354bc-edad-4099-bc22-1a68ffbc1e71@eisentraut.org
обсуждение исходный текст
Ответ на Re: Generate GUC tables from .dat file  ("David E. Wheeler" <david@justatheory.com>)
Список pgsql-hackers
On 28.08.25 20:03, David E. Wheeler wrote:
> On Aug 28, 2025, at 09:29, Daniel Gustafsson <daniel@yesql.se> wrote:
> 
>> A tiny nitpick is that all the other generator scripts (that I looked at) in
>> the tree use GetOptions() with named parameter rather than dereference ARGV
>> directly:
>>
>> +my $input_fname = $ARGV[0];
>> +my $output_fname = $ARGV[1];
> 
> GetOptions() is overkill when there are no options. I’d opt for:
> 
> die "Usage: $0 INPUT_FILE OUTPUT_FILE\n" unless @ARGV == 2;
> my ($input_fname, $output_fname) = @ARGV;

Done that way.

> And since I griped about Perl style previously, I made a pass over modernizing it a bit. One might argue it’s less
clear,of course; there is less alignment of the printing than in the original. Otherwise, I’d note:
 
> 
> * Use the /r regex return sequence to simplify dquote() (requires Perl 5.14, IIRC)

I adopted that one.  We already use that elsewhere.

> * Iterate over the data types in a single line
> * Pass lists of values to `print`
> * Use {$fh} syntax to make file handle arguments clearer

These don't match our existing style, so I'll leave that to someone who 
wants to make these sorts of changes across the whole tree.




В списке pgsql-hackers по дате отправления: