BUG #1236: still in use tablespaces can be removed

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1236: still in use tablespaces can be removed
Date: 2004-08-28 18:05:12
Message-ID: 20040828180512.4B0085A1069@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1236
Logged by: Fabien

Email address: coelho(at)cri(dot)ensmp(dot)fr

PostgreSQL version: 8.0 Beta

Operating system: Linux debian

Description: still in use tablespaces can be removed

Details:

Sorry if this bug was already reported.
I could not search the list as http://archives.postgresql.org/pgsql-bugs/
looks blank right now...

One can remove a tablespace although it is being
used, putting the database in a slightly incoherent
state. It was so in yesterday (27/08/2004) cvs head:

sh> mkdir /tmp/postgres
pg> CREATE TABLESPACE tsp LOCATION '/tmp/postgres';
-- ok
pg> CREATE SCHEMA s TABLESPACE tsp;
-- ok
pg> DROP TABLESPACE tsp;
-- ok...
pg> CREATE TABLE s.t(id SERIAL PRIMARY KEY);
-- ERROR... cannot create directory

The bug is simply that DROP TABLESPACE looks whether
the directory is empty, but it happens that the namespace's tablespace uses
do not create anything in the directory...

I now that I can alter the tablespace entry manually
in pg_namespace to correct this, but it looks like a bug to me anyway: the
database should not be so easy
to put in a in coherent state.

Suggested fix: create some empty file in the directory
if it is used by a namespace. don't forget to move
the file around when altering the namespace (well, once
it will be implemented).

It does not seems practical to check for namespace's uses of a tablespace as
one belong to a cluster and the other to the database.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-08-28 21:23:51 Re: BUG #1236: still in use tablespaces can be removed
Previous Message Steve Ingram 2004-08-28 16:37:56 Re: Apologies if you don't consider this a bug and I've wasted your time.