Обсуждение: Function Missing?

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

Function Missing?

От
Luke Tudor - RSG
Дата:
Dear Team,

I wrote recently describing a problem backing up my database. I believe
that I have
found the reason why the error is occurring, but i'm unsure how to fix
it. Any help would be
appreciated.

I have the error;
gettable(): relation 'genuser': cannot find function with oid 773217 for
trigger check_user

I think I may have found the answer. I have tried to list the functions
that the database has, using
\df, and the check_foriegn_key function, which I believe is part of the
Postgres database does not appear.
If I delete the trigger which is causing a problem, a new error with
another trigger appears. This trigger also
calls check_foreign_key.

Should this function 'check_foreign_key' appear on the list? Is this the
way to display it?

If it is missing, I would have to reinstall it. Is it possible to
reinstall just specific functions?

and lastly, Am I correct in thinking that functions have oid's as well
as field rows. Or could this error actually
be due to missing some data from a table? (This backup program has
worked before, but has just stopped working!?)

I know I have recently been asking lots of questions, and I do
apologize.

Take Care ~ Keep Smiling,
Luke Tudor.

luke@luketudor.com

Re: Function Missing?

От
Tom Lane
Дата:
Luke Tudor - RSG <ltt@pml.ac.uk> writes:
> Should this function 'check_foreign_key' appear on the list?

Not unless you installed the contrib/spi/refint module.  IMHO that
module is really obsolete at this point; you should consider using the
standard FOREIGN KEY support instead...

> Is this the way to display it?

Just FYI, \df is a tad selective about what it will display.  If you
think it's omitting something interesting, try a direct query on
pg_proc, eg:

    select * from pg_proc where proname like '%foo%';

> and lastly, Am I correct in thinking that functions have oid's as well
> as field rows. Or could this error actually
> be due to missing some data from a table? (This backup program has
> worked before, but has just stopped working!?)

The problem evidently is that a function that was used as a trigger got
dropped.  You will need to reinstall the function *and* drop/recreate
the triggers that depend on it.  The reinstalled function will not have
the same OID, and the triggers refer to the function by OID not name,
so the existing triggers are hopelessly busted.

Some day there will probably be a crosscheck to keep people from
dropping functions &etc that are still referenced...

            regards, tom lane