Re: corrupted rows in pg_attribute deleted

From: Lukasz Brodziak <lukasz(dot)brodziak(at)gmail(dot)com>
To: "marvin(dot)deoliveira" <marvin(dot)deoliveira(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: corrupted rows in pg_attribute deleted
Date: 2011-09-06 20:17:51
Message-ID: CAGWYGjX7O43jznSbZb=9y+ziteaaYDX1ns5oAWCTYgcswDkiAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,
First thing I would've done is to insert the two corrupted rows into
pg_attribute. The best way to get the data for the inserts is to restore a
dump of the DB into empty database and retriever the rows by running select
over pg_attribute in restored DB. Of You have EMS manager for postgres you
can export the selected rows to sql script as inserts. After-hours running
updates on corrupted DB run an update on pg_class.
If you don't have EMS write inserts yourself based on selected rows.
Since it's only 2 rows it will be quick.
Hope this helped You.
Regards
Luke

2011/9/6 marvin.deoliveira <marvin(dot)deoliveira(at)gmail(dot)com>

> --------------------------------------
> | Postgres Version 9.0.2 |
> --------------------------------------
>
> After a Kernel Panic in Debian 5, we found corrupted rows in pg_attribute
> about 2 tables.
>
> I deleted the rows and updated the pg_class.relnatts with the result of:
>
> SELECT count(*) FROM pg_attribute WHERE attnum > 0 AND attrelid = 167017 --
> Returned 22 rows.
> where 167017 is the one of the tables OID.
>
> Now I got the following messages:
>
> 1 - When PgAdmin III list the table structure for the first time:
>
> ERROR: invalid attribute number 23 for fase_laudo_apac
> LINE 1: Select count(*) as rows from only fase_laudo_apac
>
> 2- When I tried to drop the fase_laudo_apac table:
>
> An error has occourred:
>
> ERROR: cache lookup failed for attribute 3 of relation 167045
>
> Any help will be really appreciated
>
>
> -----
> Marcos Oliveira
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/corrupted-rows-in-pg-attribute-deleted-tp4775814p4775814.html
> Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

--
Łukasz Brodziak
"Do you bury me when I'm gone
Do you teach me while I'm here
Just as soon I belong
Then it's time I disappear"

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message MirrorX 2011-09-06 21:06:08 dump/restore vs vacuum full vs cluster
Previous Message marvin.deoliveira 2011-09-06 19:57:46 corrupted rows in pg_attribute deleted