Re: Bug in reindexdb's error reporting

Поиск
Список
Период
Сортировка
Искать
От
Michael Paquier
Тема
Re: Bug in reindexdb's error reporting
Дата
в 00:42:00
Msg-id
20190511004200.GA2274@paquier.xyz
Ответ на
Список
Дерево обсуждения
Bug in reindexdb's error reporting Julien Rouhaud <rjuju123@gmail.com>
Re: Bug in reindexdb's error reporting Michael Paquier <michael@paquier.xyz>
Re: Bug in reindexdb's error reporting Daniel Gustafsson <daniel@yesql.se>
Re: Bug in reindexdb's error reporting Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Bug in reindexdb's error reporting Tom Lane <tgl@sss.pgh.pa.us>
Re: Bug in reindexdb's error reporting Julien Rouhaud <rjuju123@gmail.com>
Re: Bug in reindexdb's error reporting Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Bug in reindexdb's error reporting Julien Rouhaud <rjuju123@gmail.com>
Re: Bug in reindexdb's error reporting Michael Paquier <michael@paquier.xyz>
Re: Bug in reindexdb's error reporting Tom Lane <tgl@sss.pgh.pa.us>
Re: Bug in reindexdb's error reporting Michael Paquier <michael@paquier.xyz>
Re: Bug in reindexdb's error reporting Julien Rouhaud <rjuju123@gmail.com>
Re: Bug in reindexdb's error reporting Michael Paquier <michael@paquier.xyz>
Re: Bug in reindexdb's error reporting Julien Rouhaud <rjuju123@gmail.com>
Re: Bug in reindexdb's error reporting Alvaro Herrera <alvherre@2ndquadrant.com>
On Fri, May 10, 2019 at 05:58:03PM +0200, Julien Rouhaud wrote:
> On Fri, May 10, 2019 at 5:33 PM Alvaro Herrera  wrote:
>> I did have the same thought.  It seem clear now that we should do it :-)
>> ISTM that the way to fix that problem is to use the proposed enum
>> everywhere and turn it into a string when generating the SQL command,
>> not before.
> 
> ok :)  Patch v2 attached.

The refactoring bits are fine for HEAD.  For back-branches I would
suggest using the simplest patch of upthread.

> +typedef enum ReindexType {
> +	DATABASE,
> +	SCHEMA,
> +	TABLE,
> +	INDEX
> +} ReindexType;

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

> +	switch(type)
> +	{
> +		case DATABASE:
> +			appendPQExpBufferStr(&sql, "DATABASE");
> +			break;
> +		case SCHEMA:
> +			appendPQExpBufferStr(&sql, "SCHEMA");
> +			break;
> +		case TABLE:
> +			appendPQExpBufferStr(&sql, "TABLE");
> +			break;
> +		case INDEX:
> +			appendPQExpBufferStr(&sql, "INDEX");
> +			break;
> +		default:
> +			pg_log_error("Unrecognized reindex type %d", type);
> +			exit(1);
> +			break;
> +	}

We could actually remove this default part, so as we get compiler
warning when introducing a new element.
--
Michael
В списке pgsql-hackers по дате отправления
От: Bruce Momjian
Дата:
Сообщение: Re: pg12 release notes
От: Bruce Momjian
Дата:
Сообщение: Re: pg12 release notes
FAQ