Обсуждение: sanity check fails

Поиск
Список
Период
Сортировка

sanity check fails

От
Johann Spies
Дата:
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?

I am using Postgresql 6.5.1

Johann
-- 
J.H. Spies, Hugenotestraat 29, Posbus 80, Franschhoek, 7690, South Africa
Tel/Faks 021-876-2337 Sel/Cell 082 898 1528(Johann) 082 255 2388(Hester)    "Let not your heart be troubled: ye believe
inGod,      believe also in me."       John 14:1 
 


Re: sanity check fails

От
Tom Lane
Дата:
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


Re: sanity check fails

От
Johann Spies
Дата:
Thanks Tom.

On Tue, May 16, 2000 at 12:49:33AM -0400, Tom Lane wrote:
> 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] = 96867 or
>         ...
>         pg_proc.proargtypes[7] = 96867;
> 

The output was 
proname      |proowner|prolang|proisinh|proistrusted|proiscachable|pronargs|proretset|prorettype|
proargtypes|probyte_pct|properbyte_cpu|propercall_cpu|prooutin_ratio|prosrc                       |probin
 

-------------+--------+-------+--------+------------+-------------+--------+---------+----------+-------------------+-----------+--------------+--------------+--------------+------------------------------+------
double_salary|  513726|     14|f       |t           |f            |       1|f    |        23|96867 0 0 0 0 0 0 0|
100|             0|             0|         100|SELECT $1.salary * 2 AS salary|-
 
(1 row)

I do not understand the output.  It seems to refer to some left-overs
of a tutorial I ran some time ago.  I have removed all the remaining
tables of that tutorial.  But how can I get a list of user defined
functions?  Doing a \df in psql results in an output of more that 900
lines.

Johann
-- 
J.H. Spies, Hugenotestraat 29, Posbus 80, Franschhoek, 7690, South Africa
Tel/Faks 021-876-2337 Sel/Cell 082 898 1528(Johann) 082 255 2388(Hester)    "In my Father's house are many mansions: if
itwere not     so, I would have told you. I go to prepare a place for     you. And if I go and prepare a place for you,
Iwill      come again, and receive you unto myself; that where I      am, there ye may be also."        John 14:2,3