Using default tablespace for database?

From: "Guy Rouillier" <guyr(at)masergy(dot)com>
To: "PostgreSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: Using default tablespace for database?
Date: 2004-12-01 02:12:13
Message-ID: CC1CF380F4D70844B01D45982E671B2348E459@mtxexch01.add0.masergy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've searched the archives on this subject - appreciate some
clarification on tablespaces defined during create database. Using
8.0beta5 on Linux, I've revoked permission to use default tablespaces
and created a new default tablespace for a new database with the
following:

revoke create on schema public from public
revoke create on tablespace pg_default from public
revoke create on tablespace pg_global from public
create tablespace XXXXts location '/a/b/c/XXXXts'
create database XXXXdb tablespace XXXXts

-- connect to database XXXXdb as postgres
create schema authorization YYYY

-- Now, I connect to database XXXXdb as YYYY.
create table public.t1 (f1 smallint) - fails as it should
create table t1 (f1 smallint) tablespace pg_default - fails as it should
(1) create table t1 (f1 smallint) tablespace XXXXts- fails - should it?
(2) create table t1 (f1 smallint) - succeeds

I'm unclear about the last two. Doesn't the fact that (2) succeeds
imply that (1) should also succeed? The documentation says that when
created without an explicit tablespace, the table is being created in
the default tablespace for the database. I can't verify that because
when I look in pg_class, the tablespace column is null. In psql, \d+
YYYY.t1 does not identify the tablespace. If it is not going into the
XXXXts tablespace, then where is it going, since I've prohibited it from
using the default tablespaces?

If I explicitly "grant create on tablespace XXXXts to YYYY", then (1)
works. Even then, \d+ and pg_class still show no tablespace for this
table. (1) and (2) look the same in the system catalog tables (and in
the views in PgAdmin III.)

--
Guy Rouillier

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Woodchuck Bill 2004-12-01 02:39:50 Re: USENET vs Mailing Lists Poll ...
Previous Message Larry White 2004-12-01 02:10:24 Newbie question: returning rowtypes from a plpgsql function