Re: Index file got removed

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Index file got removed
Дата
Msg-id CAB7nPqS6AQAYs8RMdpNRrJzTwbTbbKZzLQpkQoWjKG=-QdiFRg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Index file got removed  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Index file got removed  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Thu, Nov 24, 2016 at 3:50 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
>> So I have explored in the code what would be the best way to fix the problem:
>> 1) Append the correct tablespace to the SQL string of CREATE INDEX.
>> Those command strings are stored in changedIndexDefs in tablecmds.c,
>> and those get generated by pg_get_indexdef_string(), which can append
>> a tablespace if it is *not* a default. Appending *pg_default* to it
>> would be dangerous and it would have user-visible changes. OK _string
>> is not directly SQL callable but any caller of this function would be
>> impacted.
>
> I think that this is the correct fix.  There aren't any other callers
> in the core code, and even if some third party is calling it, it's
> fairly hard to see what usage would be okay with a TABLESPACE clause
> being appended some of the time but not all of the time.  Also, both
> of the other proposed fixes seem like kluges to me.
>
> I pushed a patch that fixes it that way but incorporates your regression
> test cases.

This fix looked like a kludge to me, that's why I did not do it :)
Any code paths of ALTER TABLE calling DefineIndex won't take advantage
of is_alter_table to define the tablespace, so we may be bitten again
by the same kind of problems in the future. That won't be an immediate
problem as the command strings are generated by this caller, right.
Thanks for the commit.
--
Michael

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Index file got removed
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Index file got removed