Thread: can't drop table

can't drop table

From
Brian Hirt
Date:
I'm a bit baffled by this, i can't drop a table and I'm getting the
most bizarre message that doesn't make sense to me.  To make things
worse, I was able to drop it on my test database which is a dump of
my production database running the same version of postgresql.
The index it's complaining about is the primary for a different table.

Does anyone have any ideas?

basement=# \d game_giveaway
                               Table "public.game_giveaway"
        Column        |  Type   |                       Modifiers
---------------------+---------
+--------------------------------------------------------
game_giveaway_id    | integer | not null default nextval
('game_giveaway_id_seq'::text)
game_id             | integer |
description         | text    |
date_placed_on_list | date    |
date_given_away     | date    |
given_to_user_id    | integer |
Indexes:
     "game_giveaway_pkey" PRIMARY KEY, btree (game_giveaway_id)

basement=# drop TABLE public.game_giveaway ;
ERROR:  "game_pkey" is an index
basement=# select version();
                                                  version
------------------------------------------------------------------------
---------------------------------
PostgreSQL 8.0.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC)
3.3.2 20031022 (Red Hat Linux 3.3.2-1)
(1 row)

basement=#



Re: can't drop table

From
Tom Lane
Date:
Brian Hirt <bhirt@mobygames.com> writes:
> I'm a bit baffled by this, i can't drop a table and I'm getting the
> most bizarre message that doesn't make sense to me.  To make things
> worse, I was able to drop it on my test database which is a dump of
> my production database running the same version of postgresql.
> The index it's complaining about is the primary for a different table.

> Does anyone have any ideas?

Can you get a stack trace from the errfinish call to find out what it's
doing exactly?  I suppose something is trying to open that index with
heap_open, but I dunno what.

            regards, tom lane