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

From Craig de Stigter
Subject Corrupt indices on already-dropped table (could not open relation with OID ...)
Date
Msg-id e260aad40911161852h5ca308femd8992be18b4dfcae@mail.gmail.com
Whole thread Raw
Responses Re: Corrupt indices on already-dropped table (could not open relation with OID ...)  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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:

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

pgsql-general by date:

Previous
From: Andrew Chernow
Date:
Subject: Re: "money" binary representation
Next
From: Tom Lane
Date:
Subject: Re: Corrupt indices on already-dropped table (could not open relation with OID ...)