Re: pgbench -f and vacuum
От | Fabrízio de Royes Mello |
---|---|
Тема | Re: pgbench -f and vacuum |
Дата | |
Msg-id | CAFcNs+oZi9NBUgxbQ=-uvYQpjkoiEO5qY7x6xOZ+8MEYCbj1RA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: pgbench -f and vacuum (Tatsuo Ishii <ishii@postgresql.org>) |
Ответы |
Re: pgbench -f and vacuum
|
Список | pgsql-hackers |
On Sun, Dec 21, 2014 at 12:58 PM, Tatsuo Ishii <ishii@postgresql.org> wrote:
>
> > On Sun, Dec 14, 2014 at 11:43 AM, Tatsuo Ishii <ishii@postgresql.org> wrote:
> >>> If we care enough about that case to attempt the vacuum anyway then we
> >>> need to do something about the error message; either squelch it or
> >>> check for the existence of the tables before attempting to
> >>> vacuum. Since there's no way to squelch in the server logfile, I think
> >>> checking for the table is the right answer.
> >>
> >> Fair enough. I will come up with "checking for table before vacuum"
> >> approach.
> >
> > +1 for this approach.
>
> Here is the patch I promised.
>
$ git apply /home/fabrizio/Downloads/pgbench-f-noexit-v2.patch
/home/fabrizio/Downloads/pgbench-f-noexit-v2.patch:9: trailing whitespace.
static void executeStatement2(PGconn *con, const char *sql, const char *table);
/home/fabrizio/Downloads/pgbench-f-noexit-v2.patch:10: trailing whitespace.
static bool is_table_exists(PGconn *con, const char *table);
/home/fabrizio/Downloads/pgbench-f-noexit-v2.patch:18: trailing whitespace.
/* call executeStatement() if table exists */
/home/fabrizio/Downloads/pgbench-f-noexit-v2.patch:19: trailing whitespace.
static void
/home/fabrizio/Downloads/pgbench-f-noexit-v2.patch:20: trailing whitespace.
executeStatement2(PGconn *con, const char *sql, const char *table)
error: patch failed: contrib/pgbench/pgbench.c:88
error: contrib/pgbench/pgbench.c: patch does not apply
+static void executeStatement2(PGconn *con, const char *sql, const char *table);
+ if (result == NULL)
+ {
+ PQclear(res);
+ return false;
+ }
+
+ if (*result == 't')
+ {
+ PQclear(res);
+ return false; /* table does not exist */
+ }
To simplify isn't better this way?
if (result == NULL || *result == 't')
{
{
PQclear(res);
return false; /* table does not exists */
}
}
Regards,
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello
В списке pgsql-hackers по дате отправления: