Re: Tablespace Default Behavior - Mailing list pgsql-general

From Tom Lane
Subject Re: Tablespace Default Behavior
Date
Msg-id 10223.1490846567@sss.pgh.pa.us
Whole thread Raw
In response to Tablespace Default Behavior  (harpagornis <shenlong@runbox.com>)
Responses Re: Tablespace Default Behavior
List pgsql-general
harpagornis <shenlong@runbox.com> writes:
> When I create a table, like this:
>     CREATE TABLE myschema.mytable (rc_id integer NOT NULL) TABLESPACE my_space;
> and then I do:
>     select * from pg_tables where schemaname ='myschema';
> the tablespace is blank for the new table.  When I look in PgAdmin, the
> tablespace shows up as "pg_default."   What do I need to change to create
> the table in the desired tablespace?

As you mention in your followup, the database's default tablespace is
'my_space', so the table is actually in the correct tablespace.

For implementation reasons, we force tables that are placed in the
database's default tablespace to be recorded as "stored in database's
tablespace", which shows up as blank in pg_tables.  That means that if you
change the database's tablespace the table will move along with the
rest of the database.  You might consider that either a feature or a
bug depending on your use-case, but that's how it works ...

            regards, tom lane


pgsql-general by date:

Previous
From: harpagornis
Date:
Subject: Re: Tablespace Default Behavior
Next
From: harpagornis
Date:
Subject: Re: Tablespace Default Behavior