corrupted table postgresql 8.3 - Mailing list pgsql-general

From Matteo Sgalaberni
Subject corrupted table postgresql 8.3
Date
Msg-id 53e282ef-25c9-456a-a075-56ebfe899f01@zimbra1.ovus.it
Whole thread Raw
Responses Re: corrupted table postgresql 8.3  (Tomas Vondra <tv@fuzzy.cz>)
List pgsql-general
Hi people!

I have a pg 8.3. Today I issued in a database that comand:
=# ALTER TABLE cliente ADD COLUMN pwd_expired boolean DEFAULT FALSE;
WARNING:  unexpected attrdef record found for attr 22 of rel cliente
WARNING:  unexpected attrdef record found for attr 22 of rel cliente
WARNING:  unexpected attrdef record found for attr 22 of rel cliente
ALTER TABLE
Time: 1184.404 ms

After that the table was empty.

SELECT * from cliente;
0 rows ;)
Should contain about 90k records.

I checked in the logs and there are not disk/memory issues on the server.

If I try to execute a vacuum full I get this error.
ERROR:  could not open relation 1663/36509/28638634: No such file or directory

At this time I saw two entries of table "cliente" in the pg_tables.

At this time I stopped to troubleshoot and tried to plan some tasks to recover the disaster situation.

I recovered the 98% of the data by copying manually the physical data file of the cluster of that table and the clog to
anotherpg server 8.3. 
after that in the server where i got that problem I did this:
- renamed the table to cliente_prova
- removed all the foreign key that are pointing to that table
- recreated the table
- populated the table with the production data recovered from the other server (the last 3-4 fields of the table was
unreadable,but I don't know if the method that I used to "recover" the table was technically correct... It was a
try...)
- all up and running again

Now i'm facing this:
- if I type \d cliente, I see the schema twice, one without the field "pwd_expired" and the right one that is without
it(the table that I restored) 
- unable to drop the table renamed cliente_prova
=# DROP TABLE cliente_prova;
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
NOTICE:  default for table cliente column id depends on sequence cliente_id_seq
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
WARNING:  unexpected attrdef record found for attr 22 of rel cliente_prova
ERROR:  cannot drop table cliente_prova because other objects depend on it
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

I'll stop here to describe further detail... can you suppose what is happened please?
After that can we discuss how to cleanup the situation...;)

Thanks a lot!

Matteo

pgsql-general by date:

Previous
From: Brian Trudal
Date:
Subject: Re: Single server multiple databases - extension
Next
From: Chris Angelico
Date:
Subject: Re: Complex transactions without using plPgSQL Functions. It is possible?