Re: pgbench stats per script & other stuff - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pgbench stats per script & other stuff
Date
Msg-id 20160126231755.GA580522@alvherre.pgsql
Whole thread Raw
In response to Re: pgbench stats per script & other stuff  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: pgbench stats per script & other stuff
Re: pgbench stats per script & other stuff
List 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 by date:

Previous
From: "Dickson S. Guedes"
Date:
Subject: Re: Why format() adds double quote?
Next
From: Michael Paquier
Date:
Subject: Re: Speedup twophase transactions