bug in DROP TABLESPACE

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: bug in DROP TABLESPACE
Date: 2004-07-06 09:00:06
Message-ID: 40EA6A16.9080505@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

There is bad breakage in the DROP TABLESPACE command if the only thing
"in" that tablespace is the default tablespaces for a schema:

test=# create tablespace myspace location '/home/chriskl/loc';
CREATE TABLESPACE
test=# create schema myschema tablespace myspace;
CREATE SCHEMA
test=# drop tablespace myspace;
DROP TABLESPACE
test=# select * from pg_namespace where nspname='myschema';
nspname | nspowner | nsptablespace | nspacl
----------+----------+---------------+--------
myschema | 1 | 17228 |
(1 row)

test=# select * from pg_tablespace where oid=17228;
spcname | spcowner | spclocation | spcacl
---------+----------+-------------+--------
(0 rows)

test=# create table myschema.blah (a int4);
ERROR: could not create directory
"/home/chriskl/local/data/pg_tblspc/17228/17227": No such file or directory

This is probably pretty nasty because it means there's no way to check
if dropping a tablespace is safe :(

Maybe the only solution is if nsptablespace is invalid when creating an
object in the schema, then fix it and ignore it? Or fix it when first
connecting to the database?

Chris

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergej Sergeev 2004-07-06 09:03:40 Re: [Plperlng-devel] strange bug in plperl
Previous Message Andreas Pflug 2004-07-06 08:42:21 Re: Bug with view definitions?