Re: Corrupt view in PostgreSQL 9.0.9 - Mailing list pgsql-bugs

From Mikael Kjellström
Subject Re: Corrupt view in PostgreSQL 9.0.9
Date
Msg-id 5065CA70.7010500@mksoft.nu
Whole thread Raw
In response to Re: Corrupt view in PostgreSQL 9.0.9  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Corrupt view in PostgreSQL 9.0.9  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On 2012-09-28 16:35, Tom Lane wrote:

> Mikael Kjellström <mikael.kjellstrom@mksoft.nu> writes:
>> # drop view communitytaxiexceptions ;
>> ERROR:  invalid attribute number 0 for communitytaxiexceptions
>
> That's pretty odd --- it implies something nasty has happened to the
> contents of pg_attribute.  It would be interesting to have a look at
>     select * from pg_attribute where attrelid = 'communitytaxiexceptions'::regclass;

Here is the result of the above query, I hope it's readable and not mangled:

# select * from pg_attribute where attrelid =
'communitytaxiexceptions'::regclass; attrelid |     attname      | atttypid | attstattarget | attlen |
attnum | attndims | attcacheoff | atttypmod | attbyva
l | attstorage | attalign | attnotnull | atthasdef | attisdropped |
attislocal | attinhcount | attacl | attoptions

----------+------------------+----------+---------------+--------+--------+----------+-------------+-----------+--------
--+------------+----------+------------+-----------+--------------+------------+-------------+--------+------------
16547| commun           |       25 |            -1 |     -1 |  1 |        0 |          -1 |        -1 | f  | x
|i        | f          | f         | f            | t         |           0 |        |          |                  |
     |               |        |    |          |             |           |  |            |          |            |
   |              |         |             |        |          |                  |          |               |        |
 |          |             |           |  |            |          |            |           |              |         |
        |        |          |                  |          |               |        |    |          |             |
    |  |            |          |            |           |              |         |             |        |    16547 |
unda            |        0 |           700 |      0 |  0 |        0 |     2883584 |   1245245 | t  |            |
  | t          | t         | t            | f         |           0 |        |    16547 | undantagid       |       25 |
          -1 |     -1 |  6 |        0 |          -1 |        -1 | f  | x          | i        | f          | f         |
f           | t         |           0 |        |    16547 | numbernamn       |       25 |            -1 |     -1 |  7 |
      0 |          -1 |        -1 | f  | x          | i        | f          | f         | f            | t         |
      0 |        |    16547 | telenummer       |       25 |            -1 |     -1 |  8 |        0 |          -1 |
 -1 | f  | x          | i        | f          | f         | f            | t         |           0 |        |    16547
|distributionname |       25 |            -1 |     -1 |  9 |        0 |          -1 |        -1 | f  | x          | i
    | f          | f         | f            | t         |           0 |        |    16547 | zoneid           |       23
|           -1 |      4 |  
10 |        0 |          -1 |        -1 | t  | p          | i        | f          | f         | f            | t
|           0 |        | 
(10 rows)


>> Is there anything thing I could do to manually remove the view or fix
>> the problem?
>
> Well, you could manually remove its pg_class and pg_type rows, and that
> should be close enough to being "gone".  But what I'm worried about is
> what other damage there is.

Yes, that is what I am afraid of also.  We had a nasty power spike and
that caused the machine to reboot.  The raid controller is equipped with
a BBU though so there shouldn't be any lost disk writes.  But you never
know.

Any point of running a vacuum full on the database or is that a bad idea?

/Mikael



pgsql-bugs by date:

Previous
From: urvancevav@gmail.com
Date:
Subject: BUG #7574: CASE in WHERE condition change result set
Next
From: Tom Lane
Date:
Subject: Re: Corrupt view in PostgreSQL 9.0.9