corrupted table postgresql 8.3

From: Matteo Sgalaberni <sgala(at)sgala(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: corrupted table postgresql 8.3
Date: 2012-03-06 15:15:12
Message-ID: 0365f51d-d538-4ea4-9742-99285cc05c36@zimbra1.ovus.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs 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 another pg 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sergey Burladyan 2012-03-06 19:36:28 Re: BUG #6480: NLS text width problem
Previous Message maczniak 2012-03-06 05:46:05 BUG #6521: cannot make connection due to "getsockname() failed: Invalid argument"

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2012-03-06 15:46:37 Unhelpful initdb error message
Previous Message Gavin Flower 2012-03-06 10:45:49 Re: what Linux to run