Re: Feature Request (and/or possible bug) re Default Tablespaces - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Feature Request (and/or possible bug) re Default Tablespaces
Date
Msg-id 25717.1341011408@sss.pgh.pa.us
Whole thread Raw
In response to Feature Request (and/or possible bug) re Default Tablespaces  (r d <rd0002@gmail.com>)
List pgsql-bugs
r d <rd0002@gmail.com> writes:
> My Database C1 definition:

> CREATE DATABASE "C1" ...
>        TABLESPACE = "C1"

> After these two statements, tablespace C1 should be the default tablespace
> for storing all objects in database C1, meaning that when I do not specify
> a tablespace, objects are stored there. Right?

Right.

> I now proceed to do:

> CREATE TABLE "TEMP1"
> (
>   "ID" bigint NOT NULL,
>   CONSTRAINT "PK_TEMP1" PRIMARY KEY ("ID" )
> );

> That makes a table "TEMP1" in tablespace C1. Ok so far.
> *But it creates the index of the PK in tablespace "pg_default" !!!*

Um ... not for me.  AFAICS, nothing is created under $PGDATA/base
when I do this.  And both the table and the index show up in pg_class
with reltablespace = 0:

d1=# select relname,reltablespace from pg_class where relname like '%TEMP%';
 relname  | reltablespace
----------+---------------
 TEMP1    |             0
 PK_TEMP1 |             0
(2 rows)

which is the correct way of indicating they belong to the database's
default tablespace.  Are you perhaps misinterpreting the zero as meaning
they'll be in pg_default?

            regards, tom lane

pgsql-bugs by date:

Previous
From: r d
Date:
Subject: Feature Request (and/or possible bug) re Default Tablespaces
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #6706: pg_upgrade fails when plpgsql dropped/re-created