Re: pg_class.relnamespace NOT IN pg_namespace.oid - Mailing list pgsql-general

From Tom Lane
Subject Re: pg_class.relnamespace NOT IN pg_namespace.oid
Date
Msg-id 18937.1330376349@sss.pgh.pa.us
Whole thread Raw
In response to pg_class.relnamespace NOT IN pg_namespace.oid  (Ireneusz Pluta <ipluta@wp.pl>)
Responses Re: pg_class.relnamespace NOT IN pg_namespace.oid
List pgsql-general
Ireneusz Pluta <ipluta@wp.pl> writes:
> It apperas that I have some entries in pg_class that have relnamespace not appearing in
> pg_namespace. So pg_dump fails with "pg_dump: schema with OID 52072764 does not exist", I guess.

That's a bit disturbing --- do you have any idea what triggered that?

> How to get rid of or fix these damaged entries? Just try to delete from pg_class manually (and then
> delete files pointed to by their relfilenode)? Or create a new schema and update
> pg_class.relnamespace to the oid of the new schema and then inspect and drop?

I'd do the latter I think.  Keep in mind that there are probably also
entries in pg_depend linking the tables to the schemas.  If your goal is
only to get to a clean dumpable state and then dump and reload the
database, you probably don't need to worry about fixing pg_depend.
However, if you intend to keep on using the database without a reload,
it'd be prudent to make sure pg_depend is straightened out as well.

            regards, tom lane

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Having a problem with RoR-3.1.1 and Pg-9.1
Next
From: "James B. Byrne"
Date:
Subject: Re: Having a problem with RoR-3.1.1 and Pg-9.1