Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)

Поиск
Список
Период
Сортировка
От John Naylor
Тема Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)
Дата
Msg-id CAJVSVGUbgkYxf2B=e0Y1h46_hT=9v7Xz0iv-5BiBOwNinxhOdA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: reducing the footprint of ScanKeyword (was Re: Large writablevariables)  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Список pgsql-hackers
On 12/27/18, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> diff --git a/src/tools/gen_keywords.pl b/src/tools/gen_keywords.pl
> +    elsif ($arg =~ /^-o/)
> +    {
> +        $output_path = length($arg) > 2 ? substr($arg, 2) : shift @ARGV;
> +    }
>
> My perl-fu is not great, but it looks like this will accept arguments
> like "-ofilename", which is a style I don't like at all.  I'd rather
> either insist on the filename being separate or write the switch like
> "-o=filename".  Also, project style when taking both forms is usually
> more like
>     -o filename
>     --offset=filename

This style was cargo-culted from the catalog scripts. I can settle on
just the first form if you like.

> +$kw_input_file =~ /((\w*)kwlist)\.h/;
> +my $base_filename = $1;
> +$prefix = $2 if !defined $prefix;
>
> Hmm, what happens if the input filename does not end with "kwlist.h"?

If that's a maintainability hazard, I can force every invocation to
provide a prefix instead.

> I looked very briefly at v4-0002, and I'm not very convinced about
> the "middle" aspect of that optimization.  It seems unmaintainable,
> plus you've not exhibited how the preferred keywords would get selected
> in the first place (wiring them into the Perl script is surely not
> acceptable).

What if the second argument of the macro held this info? Something like:

PG_KEYWORD("security", FULL_SEARCH, UNRESERVED_KEYWORD)
PG_KEYWORD("select", OPTIMIZE, SELECT, RESERVED_KEYWORD)

with a warning emitted if more than one keyword per range has
OPTIMIZE. That would require all keyword lists to have that second
argument, but selecting a preferred keyword would be optional.

-John Naylor


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: random() (was Re: New GUC to sample log queries)
Следующее
От: Dmitry Dolgov
Дата:
Сообщение: Re: using index or check in ALTER TABLE SET NOT NULL