Re: Verifying variable names in pgbench

Поиск
Список
Период
Сортировка
От Takahiro Itagaki
Тема Re: Verifying variable names in pgbench
Дата
Msg-id 20100104103442.98BA.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответ на Verifying variable names in pgbench  (Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>)
Ответы Re: Verifying variable names in pgbench  (Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> wrote:

> > The attached patch verifies variable names at definition.
> >     $ pgbench -D var:name=value
> >     (global): invalid variable name 'var:name'
>
> I have reviewed this patch.  I think that the basic idea of rejecting
> invalid variable names is probably a good one, but I'm not totally
> happy with the implementation.  In particular:
>
> 1. The code that prints the invalid variable name message seems
> bizarrely complex and inexplicable relative to the way errors are
> handled elsewhere in the code.  If we really need to do this, it
> should be in its own function, not buried inside putVariable(), but
> isn't there some simpler alternative?

We can remove the complexity if we give up showing the command (arg0)
in error messages. Shall we remove it? Simplified patch attached.

> 2. I think it would be worth abstracting the actual test into a
> separate function, like isLegalVariableName().
> 3. In the department of nitpicking, I believe that the for loop test
> should be written as something like name[i] != '\0' rather than just
> name[i], for clarity.

Adjusted.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center


Вложения

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: PATCH: Add hstore_to_json()
Следующее
От: Takahiro Itagaki
Дата:
Сообщение: Re: pg_read_file() and non-ascii input file