8.3.5: Types with typnamespace pointing at non-existent pg_namespace oid - Mailing list pgsql-bugs

From Daniel Farina
Subject 8.3.5: Types with typnamespace pointing at non-existent pg_namespace oid
Date
Msg-id AANLkTintLoKYsowSW5XiUW_eaX-xCGe+SvyrdzDR1HE3@mail.gmail.com
Whole thread Raw
Responses Re: 8.3.5: Types with typnamespace pointing at non-existent pg_namespace oid  (Daniel Farina <daniel@heroku.com>)
List pgsql-bugs
A medium-length story short, this query returns non-zero:

select count(distinct typnamespace) from pg_type where  not exists
(select 1 from pg_namespace where oid = pg_type.typnamespace);

I did a very brief search in all the release notes for 8.3.5 to
8.3.14, but have not found precisely what I was looking for (searches
for namespace, schema, type, and corruption).

This was discovered when performing a pg_dump of this user's database,
whereby pg_dump complained when trying to dump types for lack of a
good catalog entry to nab the namespace name from. In our case, two
namespaces seem to be affected. The user of this database was never
privileged enough to even perform CREATE SCHEMA, to my knowledge, and
in fact only have the schema (owned by the postgres superuser) that
they began with.

Is it safe to perform an UPDATE on pg_type to give entries a valid
typnamespace? Is there any forensic evidence I can grab before doing
that to assist in figuring out the mechanism for this bug, if
applicable?

Cheers.

--
fdr

pgsql-bugs by date:

Previous
From: Maxim Boguk
Date:
Subject: Re: BUG #5798: Some weird error with pl/pgsql procedure
Next
From: Daniel Farina
Date:
Subject: Re: 8.3.5: Types with typnamespace pointing at non-existent pg_namespace oid