Re: Error: "catalog is missing 8 attribute(s) for relid 16683"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Alexandru Coseru" <alex_spam(at)distinctgroup(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Error: "catalog is missing 8 attribute(s) for relid 16683"
Date: 2005-03-02 19:36:32
Message-ID: 12914.1109792192@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Alexandru Coseru" <alex_spam(at)distinctgroup(dot)net> writes:
> [root(at)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ioannis Theoharis 2005-03-02 19:49:09 Re: Index size
Previous Message Tom Lane 2005-03-02 19:16:29 Re: [Auth] "ident" method and LDAP user accounts