Re: Bug in reindexdb's error reporting - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: Bug in reindexdb's error reporting
Date
Msg-id CAOBaU_Y_9HfGVJPX1E6HhCD2XETG4F1ynOtfQtpg5S0T-6fehA@mail.gmail.com
Whole thread Raw
In response to Re: Bug in reindexdb's error reporting  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Bug in reindexdb's error reporting  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On Fri, May 10, 2019 at 4:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> > On 2019-May-10, Julien Rouhaud wrote:
> >> I just noticed that reindexdb could report an extraneous message
> >> saying an error happened while reindexing a database if it failed
> >> reindexing a table or an index.
>
> > Kudos, good find -- that's a 14 years old bug, introduced in this commit:
>
> Yeah :-(.
>
> Patch is good as far as it goes, but I wonder if it'd be smarter to
> convert the function's "type" argument from a string to an enum,
> and then replace the if/else chains with switches?

I've also thought about it.  I think the reason why type argument was
kept as a string is that reindex_one_database is doing:

    appendPQExpBufferStr(&sql, type);

to avoid an extra switch to append the textual reindex type.  I don't
have a strong opinion on whether to change that on master or not.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Unexpected "shared memory block is still in use"
Next
From: Alvaro Herrera
Date:
Subject: Re: Bug in reindexdb's error reporting