Re: Database corruption with duplicate tables. - Mailing list pgsql-general

From Tom Lane
Subject Re: Database corruption with duplicate tables.
Date
Msg-id 29521.1271698346@sss.pgh.pa.us
Whole thread Raw
In response to Database corruption with duplicate tables.  (George Woodring <george.woodring@iglass.net>)
Responses Re: Database corruption with duplicate tables.  (George Woodring <george.woodring@iglass.net>)
List pgsql-general
George Woodring <george.woodring@iglass.net> writes:
> Upon investigation I found that I have a table that is in the database twice

> db=> select oid, relname from pg_class where oid IN (26770910,
> 26770918, 26770919);
>    oid    |                relname
> ----------+---------------------------------------
>  26770910 | availcpedata_20100410
>  26770918 | availcpedata_20100410_date_index
>  26770919 | availcpedata_20100410_pollgrpid_index
>  26770910 | availcpedata_20100410
> (4 rows)

It's not immediately clear whether that's really two instances of the
row for availcpedata_20100410, or a false hit due to index corruption.
If you include ctid in the query, do the rows have distinct ctids?
If not, reindexing pg_class should fix it.

> Can anyone suggest a strategy for removing the table?  I don't want to
> start randomly deleting stuff from the catalogs.

If there are two, manually deleting one is the only way to fix it.  Use
the ctid to make sure you remove only one ...

            regards, tom lane

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Database corruption with duplicate tables.
Next
From: Alban Hertroys
Date:
Subject: Re: Ltree - how to sort nodes on parent node