Reputation: 344
My friend copied the "data" directory to format his customer pc and restore the postgres database but now the database is showing a lot of erros about catalogs missing.
The tables load only the columns but without data and there are no views.
Do you have some idea that we can do in this case to solve this issue? We already tried this links: http://grokbase.com/t/postgresql/pgsql-hackers/051ebftr4m/fatal-catalog-is-missing-1-attribute-s-for-relid-16396 and http://www.justskins.com/forums/error-catalog-is-missing-208043.html
Thanks, Regards
Leandro
Upvotes: 1
Views: 6739
Reputation: 11
Yor need to restore from backup or, if backup is missing then check regclass of corrupted table
And then your need to restore missing record in pg_attribute (for example create simm table and copy
with q as ( select attname, atttypid, attstattarget, attlen, attnum, attndims, attcacheoff, atttypmod, attbyval, attstorage,attalign, attnotnull, atthasdef, attisdropped, attislocal, attinhcount, attcollation, attacl, attoptions, attfdwoptions from pg_attribute where attrelid::regclass = your_table::regclass) ) INSERT INTO pg_catalog.pg_attribute select [id from your pgclass missing instead new attrelid], * from q
Then check, that atttypid is exists and do vacuum on pg_class and pg_attribute. So, your problem must be solved. Sorry for my english
Upvotes: 1
Reputation: 324841
Your friend should've probably read the manual: backup and restore, upgrading between releases.
The datadir can be copied to another machine only if:
pg_xlog
, base
, pg_clog
, any tablespace directories; etcViolate any of those rules and if the server starts at all, it'll start with damaged / unreadable data.
Upvotes: 2
Reputation: 45910
It looks like using different PostgreSQL versions. Data in PostgreSQL data dir is very sensitive and you cannot it copy to different computer without deeper knowledge. Use pg_dump instead. Don't touch to PostgreSQL data dir if you don't know what your do well.
Upvotes: 1