Skip site navigation (1) Skip section navigation (2)

8.3.5: Types with typnamespace pointing at non-existent pg_namespace oid

From: Daniel Farina <daniel(at)heroku(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: 8.3.5: Types with typnamespace pointing at non-existent pg_namespace oid
Date: 2011-02-22 06:43:58
Message-ID: AANLkTintLoKYsowSW5XiUW_eaX-xCGe+SvyrdzDR1HE3@mail.gmail.com (view raw or flat)
Thread:
Lists: 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

Responses

pgsql-bugs by date

Next:From: Daniel FarinaDate: 2011-02-22 06:46:45
Subject: Re: 8.3.5: Types with typnamespace pointing at non-existent pg_namespace oid
Previous:From: Maxim BogukDate: 2011-02-22 06:43:10
Subject: Re: BUG #5798: Some weird error with pl/pgsql procedure

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group