Re: Bug in reindexdb's error reporting
От | Michael Paquier |
---|---|
Тема | Re: Bug in reindexdb's error reporting |
Дата | |
Msg-id | 20190511004200.GA2274@paquier.xyz обсуждение исходный текст |
Ответ на | Re: Bug in reindexdb's error reporting (Julien Rouhaud <rjuju123@gmail.com>) |
Ответы |
Re: Bug in reindexdb's error reporting
|
Список | pgsql-hackers |
On Fri, May 10, 2019 at 05:58:03PM +0200, Julien Rouhaud wrote: > On Fri, May 10, 2019 at 5:33 PM Alvaro Herrera <alvherre@2ndquadrant.com> 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 по дате отправления: