Re: bugfix - contrib/pgbench
| От | Neil Conway |
|---|---|
| Тема | Re: bugfix - contrib/pgbench |
| Дата | |
| Msg-id | 4292758E.9000308@samurai.com обсуждение исходный текст |
| Ответ на | Re: bugfix - contrib/pgbench (ITAGAKI Takahiro <itagaki.takahiro@lab.ntt.co.jp>) |
| Список | pgsql-patches |
ITAGAKI Takahiro wrote:
> But this code seems to be an idiom,
> "Check the result, but drop commands may be fail".
> Drop commands might be added to DDLAFTERs some time, so we may leave it.
Possibly, but I think checking for something that cannot occur is
confusing to the reader (and besides, it is not correct in general to
ignore errors from _all_ DDL commands that begin with "drop"). So I just
removed the strncmp(). Thanks for the report; this is fixed in HEAD.
BTW, there is probably room for some refactoring here: the pattern
res = PQexec(con, "...");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
fprintf(stderr, "...");
exit(1);
}
occurs frequently. That could be refactored into an exec_sql_cmd()
function or similar that would only return on non-error. Or at the very
least, a fatal_error() function that takes the error message and then
does the exit(1).
-Neil
В списке pgsql-patches по дате отправления: