"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
* 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 Stark||Date: 2005-01-14 17:22:11|
|Subject: Re: [HACKERS] Much Ado About COUNT(*)|
|Previous:||From: Tom Lane||Date: 2005-01-14 17:12:28|
|Subject: Re: FATAL: catalog is missing 1 attribute(s) for relid 16396 |