Re: pgbench stats per script & other stuff

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: pgbench stats per script & other stuff
Дата
Msg-id 20160126231755.GA580522@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: pgbench stats per script & other stuff  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: pgbench stats per script & other stuff  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: pgbench stats per script & other stuff  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-hackers
Fabien COELHO wrote:

> a) add -b option for cumulating builtins and rework internal script
>    management so that builtin and external scripts are managed the
>    same way.

I'm uncomfortable with the prefix-matching aspect of -b.  It makes
"-b s" ambiguous -- whether it stands for select-only or simple-update
is merely a matter of what comes earlier in the table, which doesn't
seem reasonable to me.  I'd rather have a real way to reject ambiguous
cases, or simply accept only complete spellings.  This is the guilty
party:

> +static char *
> +find_builtin(const char *name, char **desc)
> +{
> +    int        len = strlen(name), i;
> +
> +    for (i = 0; i < N_BUILTIN; i++)
> +    {
> +        if (strncmp(builtin_script[i].name, name, len) == 0)
> +        {
> +            *desc = builtin_script[i].desc;
> +            return builtin_script[i].script;
> +        }
> +    }

I'm going to change this to use strlen(builtin_script[i].name) instead
of "len" here.

If you want to implement real non-ambiguous-prefix code (i.e. have "se"
for "select-only", but reject "s" as ambiguous) be my guest.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: "Dickson S. Guedes"
Дата:
Сообщение: Re: Why format() adds double quote?
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Speedup twophase transactions