Re: pgbench stats per script & other stuff

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: pgbench stats per script & other stuff
Дата
Msg-id alpine.DEB.2.10.1602011704430.13459@sto
обсуждение исходный текст
Ответ на Re: pgbench stats per script & other stuff  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: pgbench stats per script & other stuff  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Hello Michaël,

Two rebase attached.

>>  - 15-e: prefix selection for -b

> -               if (strncmp(builtin_script[i].name, name,
> -                                       strlen(builtin_script[i].name)) == 0)
> +               if (strncmp(builtin_script[i].name, name, len) == 0)
>
> I agree with Alvaro here: this should remain unchanged. It seems to be
> a rebase mistake.

I do not understand. I tested it and it works as expected. If I put the 
above strlen instead the suffix detection does not work:

 fabien@sto:bin/pgbench> git diff diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index
783cbf9..0c33012100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -2684,7 +2684,7 @@
findBuiltin(constchar *name, char **desc)
 
         for (i = 0; i < N_BUILTIN; i++)         { -               if (strncmp(builtin_script[i].name, name, len) == 0)
+              if (strncmp(builtin_script[i].name, name, strlen(builtin_script[i].name)) == 0)                 {
                *desc = builtin_script[i].desc;                         commands = builtin_script[i].commands;
 

 ./pgbench -b t no builtin script found for name "t" Available builtin scripts:         tpcb-like         simple-update
       select-only
 

Indeed, then it can only match if the provided "name" is as long as the 
recorded len. The point of the "suffix" selection is to align to the short 
supplied string.

-- 
Fabien.

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: PL/Pythonu - function ereport
Следующее
От: Artur Zakirov
Дата:
Сообщение: Re: Fuzzy substring searching with the pg_trgm extension