Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id AFE5F171224E for ; Tue, 6 Mar 2012 17:02:22 -0400 (AST) Received: from [2001:1528:137::f1] (helo=mail.gransy.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S51WS-0005TW-Ok for pgsql-general@postgresql.org; Tue, 06 Mar 2012 21:02:21 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id 1806C4A2142 for ; Tue, 6 Mar 2012 22:02:02 +0100 (CET) Received: from mail.gransy.com ([82.208.29.194]) by antispam.gransy.com (antispam.gransy.com [77.78.104.124]) (amavisd-new, port 10024) with ESMTP id Q3g7JyKS6hoL for ; Tue, 6 Mar 2012 22:02:02 +0100 (CET) Received: by mail.gransy.com (Postfix, from userid 5000) id 0822036800B; Tue, 6 Mar 2012 22:02:02 +0100 (CET) Received: from [192.168.1.237] (ip-78-45-133-255.net.upcbroadband.cz [78.45.133.255]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id D81334A2142 for ; Tue, 6 Mar 2012 22:02:01 +0100 (CET) Message-ID: <4F567B4A.1040507@fuzzy.cz> Date: Tue, 06 Mar 2012 22:02:02 +0100 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Re: corrupted table postgresql 8.3 References: <53e282ef-25c9-456a-a075-56ebfe899f01@zimbra1.ovus.it> In-Reply-To: <53e282ef-25c9-456a-a075-56ebfe899f01@zimbra1.ovus.it> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:1528:137::f1 (failed) X-Pg-Spam-Score: -1.1 (-) X-Archive-Number: 201203/169 X-Sequence-Number: 185495 On 6.3.2012 21:24, Matteo Sgalaberni wrote: > Hi people! > > I have a pg 8.3. Today I issued in a database that comand: Which minor version? The last one in this branch is 8.3.18 and if you're running an old one, there might be an important bugfix ... > =# 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. That proves nothing. It might be a PostgreSQL bug but just as well it might be a silent disk corruption somewhere, unspotted for a long time. > 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: Not sure what you mean by 'physical data file of the cluster' but you should do a file-level backup of the whole cluster right now. Before trying to fix the issues (possibly damaging the data). Then get the last 8.3.x release (if you're using an old one). > - 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 What do you mean by 'populated the table' with the production data? How did you do that? kind regards Tomas