Re: Index file got removed

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>, sudalai <sudalait2(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Index file got removed
Date: 2016-11-23 22:05:58
Message-ID: CAB7nPqS6AQAYs8RMdpNRrJzTwbTbbKZzLQpkQoWjKG=-QdiFRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Nov 24, 2016 at 3:50 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Michael Paquier <michael(dot)paquier(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-11-23 22:46:11 Re: Index file got removed
Previous Message Tom Lane 2016-11-23 18:50:19 Re: Index file got removed