Skip site navigation (1) Skip section navigation (2)

Re: FATAL: catalog is missing 1 attribute(s) for relid 16396

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: FATAL: catalog is missing 1 attribute(s) for relid 16396
Date: 2005-01-14 17:20:56
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
"Marc G. Fournier" <scrappy(at)postgresql(dot)org> writes:
> course that won't work, since its link'd to the oid of the table name :( 
> whose idea was this "let's name the files by the OID" again? :(

Actually, I think you can make this work, if you are sure of the schema
of the old database.  Try something like this:

* Continue to work in the same installation; don't initdb.  If you did
initdb then old transaction numbers would be wrong.  Just create a new
database beside the old one (or maybe better, physically copy the old
one someplace and then drop and re-createdb it).

* Rebuild the schema.  Now you have a lot of empty tables and you just
have to get the old data into them.  That means you have to find out the
mapping from old table filenode numbers to new ones.

* To find out the old numbers, make a user table that has the identical
schema to pg_class (probably easiest to do this with the LIKE clause of
CREATE TABLE).  Check its relfilenode number in pg_class, then copy the
old database's pg_class file over that relfilenode.  Now you can query
this table to see the contents of the old pg_class.

* Join the new and old pg_class together to get corresponding
relfilenode numbers.

* Copy old table files into new database per the above.  (I'd make a
script to do this instead of doing it by hand...)  Also you'll need to
copy corresponding TOAST tables.  Don't copy indexes though.

* REINDEX all the indexes, and I think you're there.

It may take a couple tries to get this right, but as long as you made a
copy of the old database to start with, you can start over...

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Greg StarkDate: 2005-01-14 17:22:11
Subject: Re: [HACKERS] Much Ado About COUNT(*)
Previous:From: Tom LaneDate: 2005-01-14 17:12:28
Subject: Re: FATAL: catalog is missing 1 attribute(s) for relid 16396

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group