Re: bugfix - contrib/pgbench

From: Neil Conway <neilc(at)samurai(dot)com>
To: ITAGAKI Takahiro <itagaki(dot)takahiro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: bugfix - contrib/pgbench
Date: 2005-05-24 00:30:06
Message-ID: 4292758E.9000308@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2005-05-24 00:35:10 Re: plperl tests for currently untested features
Previous Message John Hansen 2005-05-23 23:29:01 Re: [PATCHES] character type value is not padded with spaces