problem/bug in drop tablespace?

From: Michael Nolan <htfoot(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: problem/bug in drop tablespace?
Date: 2012-05-08 04:13:42
Message-ID: CAOzAquJzjmxYXxkmV9ee2JGz0vG1qubRu6DZG+6uU5Tr6odpOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While researching a problem reported on the -general list by a user who
lost a disk containing his index tablespace, I ran into something, but I'm
not sure is a serious bug or just an inconsistency in how \d shows tables.

Here are the steps I took.

1. Create a new database 'MYDB' and connect to it.
2. Create a new tablespace 'MYTBLSP'
3. Create a table 'MYTABLE' and populate it.
4. Create an index 'MYIND' on that table, with the index in the new
tablespace, MYTBLSP.

Now, exit psql and delete the files in the tablespace directory created in
step 2, simulating the problem the user had.

Trying to execute an SQL command on the table MYTABLE will, as expected,
generate an error.

Now, drop tablespace MYTBLSP. This will produce an error, but it will
delete the tablespace according to \db.

Recreate tablespace MYTBLSP.

Regenerate the index on MYTABLE. Queries will work on this table again, as
expected.

Now, here's the problem I ran into:

The index will be rebuilt in tablespace MYTBLSP, but \d on table MYTABLE
will not show the index as being in that tablespace.
--
Mike Nolan

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2012-05-08 09:01:05 Re: Temporary tables under hot standby
Previous Message Robert Haas 2012-05-08 02:16:33 CLOG background writing