Re: make default TABLESPACE belong to target table. - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: make default TABLESPACE belong to target table.
Date
Msg-id CAB7nPqTu=9f67LEyXf4QqN3592QFoSV2FHpHr4UF6GJ-GU4uDQ@mail.gmail.com
Whole thread Raw
In response to Re: make default TABLESPACE belong to target table.  (Amos Bird <amosbird@gmail.com>)
Responses Re: make default TABLESPACE belong to target table.
List pgsql-hackers
On Fri, Nov 25, 2016 at 10:47 PM, Amos Bird <amosbird@gmail.com> wrote:
>> So you would like locate those index tablespaces into the same
>> tablespace as its parent relation when the index is created for a
>> unique index or as a primary key?
>
> Yes, and I'd like this behavior take effect when default_tablespace is
> set to something like "parent".

The only scenario where this would be useful is when using ALTER TABLE
ADD CONSTRAINT in which case a fresh index is built (not USING INDEX).
That's a bit narrow, because it would mean that you would either
append a TABLESPACE clause to this existing clause, or create a
storage parameter to enforce all indexes created for a relation on a
wanted tablespace... For the other cases you could just do something
like that, and that's what the large majority of people would care
about:
SET default_tablespace TO 'foo';
CREATE TABLE foobar (id int PRIMARY KEY);
But that's not the one you are interesting in, so likely a storage
parameter is what pops up in my mind, with parameter defined at table
creation: CREATE TABLE foo (id primary key) WITH
(constraint_default_tablespace = foo) TABLESPACE bar;
In this case the parent relation gets created in tablespace bar, but
its primary key gets in tablespace foo.
-- 
Michael



pgsql-hackers by date:

Previous
From: Amos Bird
Date:
Subject: Re: make default TABLESPACE belong to target table.
Next
From: Amit Kapila
Date:
Subject: Re: UNDO and in-place update