Re: Index file got removed

Поиск
Список
Период
Сортировка
От Julien Rouhaud
Тема Re: Index file got removed
Дата
Msg-id e7f50e1e-afa2-a31a-7c40-a57e4c501485@dalibo.com
обсуждение исходный текст
Ответ на Re: Index file got removed  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Index file got removed  (Julien Rouhaud <julien.rouhaud@dalibo.com>)
Список pgsql-bugs
On 16/11/2016 18:26, Tom Lane wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
>> On Wed, Nov 16, 2016 at 3:16 AM, sudalai <sudalait2@gmail.com> wrote:
>>> I am creating a table test and index for that table on  default tablespace.
>>> Then i'm changing default_tablespace to some other tablespace.
>>> After that altering one of the index column.
>>> This alter operation moves the index to new default_tablespace, but index
>>> file is missing in new tablespace.
>
>> I am just digging into it, instinctively that would be something in
>> tablecmds.c..
>
> I'm betting that where it reconstructs textual commands to create the new
> indexes, it's forgotten to do anything about tablespaces.

I looked at it, and IIUC the issue is that during AT_PASS_OLD_INDEX
pass, ATExecAddIndex defines a new index using the old heap in original
tablespace (stmt->oldNode is valid), and DefineIndex will create a new
cat entry using the current default tablespace instead of the existing
index one.

The only way I found to fix this is to save the original tablespace in
ATExecAddIndex() if the old heap is reused, see attached patch. I'm not
at all familiar with this part of code, but at least initdb and
regression tests don't fail.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

Вложения

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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Postgres 9.6.1 accepts connections from not allowed Ip addresses
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: Index file got removed