Re: Error: "catalog is missing 8 attribute(s) for relid 16683" - Mailing list pgsql-general

From Tom Lane
Subject Re: Error: "catalog is missing 8 attribute(s) for relid 16683"
Date
Msg-id 12914.1109792192@sss.pgh.pa.us
Whole thread Raw
In response to Error: "catalog is missing 8 attribute(s) for relid 16683"  ("Alexandru Coseru" <alex_spam@distinctgroup.net>)
Responses Re: Error: "catalog is missing 8 attribute(s) for relid 16683"
List pgsql-general
"Alexandru Coseru" <alex_spam@distinctgroup.net> writes:
> [root@gw gateway]# psql -U postgres  -h 127.0.0.1 template1
> Welcome to psql 7.4.5, the PostgreSQL interactive terminal.

> Type:  \copyright for distribution terms
>        \h for help with SQL commands
>        \? for help on internal slash commands
>        \g or terminate with semicolon to execute query
>        \q to quit
> template1=3D# \dt
> ERROR:  catalog is missing 8 attribute(s) for relid 16683
> template1=3D# VACUUM FULL;
> ERROR:  catalog is missing 3 attribute(s) for relid 16656

Something very bad has happened to pg_attribute.  I don't think there's
any useful way to recover that database; however, if it's only template1
that is corrupted, you could drop template1 and recreate it from
template0 (see techdocs.postgresql.org for detailed instructions).

The rest of your message suggests that the same corruption has occurred
in both template1 and your "mydata" database.  That's really odd.  Maybe
template1 was already broken when you cloned it to make mydata?  But I
think you'd have noticed before getting very far.

It's barely possible that you could get to a state where pg_dump would
succeed by dropping and recreating the pg_user view --- since it's only
a view, there's no data to lose.  I expect that DROP VIEW would not work
but you could simply delete the pg_class row (DELETE FROM pg_class WHERE
oid = 16683) and then make a new view using the same definition you see
in the initdb script:

CREATE VIEW pg_catalog.pg_user AS
    SELECT
        usename,
        usesysid,
        usecreatedb,
        usesuper,
        usecatupd,
        '********'::text as passwd,
        valuntil,
        useconfig
    FROM pg_shadow;


            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [Auth] "ident" method and LDAP user accounts
Next
From: Ioannis Theoharis
Date:
Subject: Re: Index size