Re: Using ALTER TABLESPACE in pg_dump - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Using ALTER TABLESPACE in pg_dump
Date
Msg-id 200410260352.i9Q3qjW03085@candle.pha.pa.us
Whole thread Raw
In response to Re: Using ALTER TABLESPACE in pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> > I think a viable solution is to go with the latter (ie, for CREATE TABLE
> > foo(i int primary key) TABLESPACE ts; the index on i is created in
> > default_tablespace). However, I might be nice to be able to specify the
> > tablespace as part of the primary key clause. I say nice, but not
> > necessary.
> 
> We already have that don't we?
> 
> create table foo (f1 int,
>                   primary key (f1) using index tablespace its)
>                   tablespace tts;
> 
> The question is where to put foo_pkey when "using index tablespace"
> isn't there but "tablespace" is.

I think that lacking a tablespace clause in the index section the
behavior of least surprise would be to use the outer tablespace
specification if it exists, and if not use the GUC variable for the
tablespace (basically the tablespace of the table for the index).  We
already name the tablespace using our own name if we create it as part
of CREATE TABLE so it seems natural to also use the tablespace of the
table.  The idea that a non-specified value defaults to the outer
level's default (tablespace) is a natural behavior people expect.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Using ALTER TABLESPACE in pg_dump
Next
From: Bruce Momjian
Date:
Subject: Re: Command-line parsing in pg_ctl is not portable