From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pgbench stats per script & other stuff |
Date: | 2016-01-26 23:17:55 |
Message-ID: | 20160126231755.GA580522@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2016-01-27 01:31:41 | Re: Speedup twophase transactions |
Previous Message | Dickson S. Guedes | 2016-01-26 22:29:20 | Re: Why format() adds double quote? |