Re: Make name optional in CREATE STATISTICS

Поиск
Список
Период
Сортировка
От Matthias van de Meent
Тема Re: Make name optional in CREATE STATISTICS
Дата
Msg-id CAEze2WjCAo3s1TLWLNLr+rgGQri3+1=p+wtOEWquLzc2PGWHAg@mail.gmail.com
обсуждение исходный текст
Ответ на Make name optional in CREATE STATISTICS  (Simon Riggs <simon.riggs@enterprisedb.com>)
Ответы Re: Make name optional in CREATE STATISTICS  (Simon Riggs <simon.riggs@enterprisedb.com>)
Список pgsql-hackers
On Sun, 15 May 2022 at 14:20, Simon Riggs <simon.riggs@enterprisedb.com> wrote:
>
> Currently, CREATE STATS requires you to think of a name for each stats
> object, which is fairly painful, so users would prefer an
> automatically assigned name.
>
> Attached patch allows this, which turns out to be very simple, since a
> name assignment function already exists.
>
> The generated name is simple, but that's exactly what users do anyway,
> so it is not too bad.

Cool.

> Tests, docs included.

Something I noticed is that this grammar change is quite different
from how create index specifies its optional name. Because we already
have a seperate statement sections for with and without IF NOT EXISTS,
adding another branch will add even more duplication. Using a new
opt_name production (potentially renamed from opt_index_name?) would
probably reduce the amount of duplication in the grammar.

We might be able to use opt_if_not_exists to fully remove the
duplicated grammars, but I don't think we would be able to keep the
"CREATE STATISTICS IF NOT EXISTS <<no name>> ON col1, col2 FROM table"
syntax illegal.

Please also update the comment in gram.y above the updated section
that details the expected grammar for CREATE STATISTICS, as you seem
to have overlooked that copy of grammar documentation.

Apart from these two small issues, this passes tests and seems complete.


Kind regards,

Matthias van de Meent



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

Предыдущее
От: Jacob Champion
Дата:
Сообщение: Re: Make mesage at end-of-recovery less scary.
Следующее
От: Alexander Korotkov
Дата:
Сообщение: Re: Add red-black tree missing comparison searches