Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 044B41460D43 for ; Fri, 29 Jun 2012 20:10:27 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SkkKU-0007Fn-FZ for pgsql-bugs@postgresql.org; Fri, 29 Jun 2012 23:10:27 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q5TNA9EV025718; Fri, 29 Jun 2012 19:10:09 -0400 (EDT) From: Tom Lane To: r d cc: pgsql-bugs@postgresql.org Subject: Re: Feature Request (and/or possible bug) re Default Tablespaces In-reply-to: References: Comments: In-reply-to r d message dated "Fri, 29 Jun 2012 21:49:57 +0200" Date: Fri, 29 Jun 2012 19:10:08 -0400 Message-ID: <25717.1341011408@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/241 X-Sequence-Number: 33468 r d 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