From: Julien Rouhaud <julien.rouhaud@dalibo.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: sudalai <sudalait2@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: Index file got removed
Date: Tue, 22 Nov 2016 20:32:12 +0100
Message-ID: <20161122193212.GD22157@nol.local> (raw)
In-Reply-To: <CAB7nPqSO534pVu5Uuqq9RVJKkCaoGxMnW-sVho8DpWgfeWK11w@mail.gmail.com>
References: <1479294998857-5930602.post@n3.nabble.com>
<CAB7nPqRubsq9d1_ox=rkxLC-23QQ-1T3OUsiZ6O3B+RwqqqBRw@mail.gmail.com>
<23523.1479317197@sss.pgh.pa.us>
<e7f50e1e-afa2-a31a-7c40-a57e4c501485@dalibo.com>
<bc019d06-5928-d814-3193-7669c802d71c@dalibo.com>
<CAB7nPqSO534pVu5Uuqq9RVJKkCaoGxMnW-sVho8DpWgfeWK11w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On Tue, Nov 22, 2016 at 09:57:29PM +0900, Michael Paquier wrote:
>
> 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.
> 2) Take advantage of is_alter_table in DefineIndex(), and do some
> extra processing when assigning the tablespace of an index. In short,
> if IndexStmt->tablespace is NULL and DefineIndex() is used for an
> ALTER TABLE, ignore default_tablespace and assign pg_default. This
> way, the current tablespace of an index is protected all the time,
> even if the tablespace of an index is not the default.
>
> 2) is more solid, and is far less invasive than 1), and has no impact
> on existing routines of ruleutils.c, so I have implemented it with a
> set of regression tests. I am adding that to the next CF so as we
> don't forget about it. Thoughts are welcome.
I agree that 2nd solution looks better. I reviewed your patch and everything
works as intended, same for new regression tests which seem to cover all
possible cases. I mark it as ready for committers.
--
Julien Rouhaud
http://dalibo.com - http://dalibo.orgAttachments:
signature.asc (application/pgp-signature, 454B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: julien.rouhaud@dalibo.com, michael.paquier@gmail.com, tgl@sss.pgh.pa.us, sudalait2@gmail.com
Subject: Re: Index file got removed
In-Reply-To: <20161122193212.GD22157@nol.local>
References: <1479294998857-5930602.post@n3.nabble.com> <CAB7nPqRubsq9d1_ox=rkxLC-23QQ-1T3OUsiZ6O3B+RwqqqBRw@mail.gmail.com> <23523.1479317197@sss.pgh.pa.us> <e7f50e1e-afa2-a31a-7c40-a57e4c501485@dalibo.com> <bc019d06-5928-d814-3193-7669c802d71c@dalibo.com> <CAB7nPqSO534pVu5Uuqq9RVJKkCaoGxMnW-sVho8DpWgfeWK11w@mail.gmail.com> <20161122193212.GD22157@nol.local>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox