HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Why is pg_dumpall throwing an "OID does not exist'' error?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
whyerroroidexistthrowingpg_dumpalldoesnot

Problem

When I run pg_dumpall I'm now getting this:

$ pg_dumpall -f may2012
pg_dump: schema with OID 7549789 does not exist
pg_dumpall: pg_dump failed on database "dealermade", exiting


How do I resolve it?

UPDATE

Here is some of the data requested by @depesz:

select relname from pg_class where relnamespace = 7549789;
   relname    
--------------
 lotdata
 lotdata_pkey
(2 rows)

Solution

do:

select * from pg_class where relnamespace = 7549789;


and:

select * from pg_proc where pronamespace = 7549789;


These are the most likely suspects (there are other objects that can be related to schema).

Make sure you run the queries in dealermade database.

After you will see the results - answer can be obvious (for example: delete from ... where ..), or more tricky - depending on what is the bad object. But at least you will have some data.

Also - try enabling logging of all queries, and rerun pg_dump to see what was the exact query that failed.

Code Snippets

select * from pg_class where relnamespace = 7549789;
select * from pg_proc where pronamespace = 7549789;

Context

StackExchange Database Administrators Q#17546, answer score: 6

Revisions (0)

No revisions yet.