Corrupt indices on already-dropped table (could not open relation with OID ...)

From: Craig de Stigter <craig(dot)destigter(at)koordinates(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Corrupt indices on already-dropped table (could not open relation with OID ...)
Date: 2009-11-17 02:52:44
Message-ID: e260aad40911161852h5ca308femd8992be18b4dfcae@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi folks

Somehow we've ended up with a few corrupt indices in our database. We've
previously dropped the table they were on, but the indices are still there
(kind of):

Trying to drop the indices gives us:

drop index "v_0000038e_GEOMETRY";

ERROR: could not open relation with OID 9590980

Looking up that index in pg_class:

select oid, relname from pg_class where relname = 'v_0000038e_GEOMETRY';

oid | relname

---------+---------------------

9590993 | v_0000038e_GEOMETRY

And looking up those OIDs in pg_depend:

select * from pg_depend where objid = 9590993;

classid | objid | objsubid | refclassid | refobjid | refobjsubid |
> deptype

---------+---------+----------+------------+----------+-------------+---------

1259 | 9590993 | 0 | 1259 | 9590980 | 3 | a

1259 | 9590993 | 0 | 2616 | 20506 | 0 | n

But that table doesn't exist anymore (that's okay, we dropped it earlier):

select * from pg_class where oid = 9590980 or relname = 'v_0000038e';

(0 rows)

Restarting the database didn't help, unfortunately.

I'm a bit hesitant to try the fix mentioned at the following URL since it
involves deleting things from system tables:
http://javadave.blogspot.com/2005/06/could-not-open-relation-in-postgresql.html

Any suggestions for a nicer approach? Or can someone who knows tell me if
its okay to follow the instructions at that url, without breaking anything?

Thanks

Craig de Stigter

--
Koordinates Ltd
PO Box 1604, Shortland St, Auckland, New Zealand
Phone +64-9-966 0433 Fax +64-9-969 0045
Web http://www.koordinates.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-11-17 03:51:37 Re: Corrupt indices on already-dropped table (could not open relation with OID ...)
Previous Message Andrew Chernow 2009-11-17 02:03:21 Re: "money" binary representation