Johann Spies <jhspies@adept.co.za> writes:
> When I try to backup my database using pg_dump I get the following error:
> -- dumping out user-defined functions
> failed sanity check, type with oid 96867 was not found
> How can I correct that?
It sounds like you had a user-defined type that you deleted without
first having deleted all the functions that accepted or returned that
type. You can look for the culprit function with
select * from pg_proc where prorettype = 96867 or pg_proc.proargtypes[0] = 96867 or pg_proc.proargtypes[1] =
96867or ... pg_proc.proargtypes[7] = 96867;
Some room for improvement here, obviously: pg_dump ought to identify
where it found the dangling type reference, and even better you
shouldn't be able to drop a still-referenced type in the first place...
regards, tom lane