Re: pg_class.relnamespace NOT IN pg_namespace.oid

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ireneusz Pluta <ipluta(at)wp(dot)pl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_class.relnamespace NOT IN pg_namespace.oid
Date: 2012-02-27 20:59:09
Message-ID: 18937.1330376349@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ireneusz Pluta <ipluta(at)wp(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message James B. Byrne 2012-02-27 21:03:51 Re: Having a problem with RoR-3.1.1 and Pg-9.1
Previous Message Adrian Klaver 2012-02-27 20:54:48 Re: Having a problem with RoR-3.1.1 and Pg-9.1