Re: Bug in reindexdb's error reporting

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Bug in reindexdb's error reporting
Date: 2019-05-11 01:25:58
Message-ID: 2859.1557537958@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> The refactoring bits are fine for HEAD. For back-branches I would
> suggest using the simplest patch of upthread.

Makes sense to me too. The refactoring is mostly to make future
additions easier, so there's not much point for back branches.

> That's perhaps too much generic when it comes to grep in the source
> code, why not appending REINDEX_ to each element?

+1

> We could actually remove this default part, so as we get compiler
> warning when introducing a new element.

Right. Also, I was imagining folding the steps together while
building the commands so that there's just one switch() for that,
along the lines of

const char *verbose_option = verbose ? " (VERBOSE)" : "";
const char *concurrent_option = concurrently ? " CONCURRENTLY" : "";

switch (type)
{
case REINDEX_DATABASE:
appendPQExpBufferStr(&sql, "REINDEX%s DATABASE%s %s",
verbose_option, concurrent_option,
fmtId(PQdb(conn)));
break;
case REINDEX_TABLE:
appendPQExpBufferStr(&sql, "REINDEX%s TABLE%s ",
verbose_option, concurrent_option);
appendQualifiedRelation(&sql, name, conn, progname, echo);
break;
....

It seemed to me that this would be more understandable and flexible
than the way it's being done now, though of course others might see
that differently. I'm not dead set on that, just suggesting it.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2019-05-11 01:53:55 Re: pg12 release notes
Previous Message Bruce Momjian 2019-05-11 01:06:52 Re: pg12 release notes