DROP FUNCTION failure: cache lookup failed for relation X

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема DROP FUNCTION failure: cache lookup failed for relation X
Дата
Msg-id 20070122044519.GA62207@winnie.fuhr.org
обсуждение исходный текст
Ответы Re: DROP FUNCTION failure: cache lookup failed for relation X  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I've found a situation that causes DROP FUNCTION to fail (tested
in 8.1.6, 8.2.1, and 8.3devel):

CREATE TABLE foo (id integer);

CREATE FUNCTION foofunc() RETURNS trigger AS $$
BEGIN   RETURN NEW;
END;
$$ LANGUAGE plpgsql;

Then in concurrent sessions:

A: BEGIN;

A: CREATE TRIGGER footrig BEFORE INSERT ON foo    FOR EACH ROW EXECUTE PROCEDURE foofunc();

B: DROP TABLE foo;  -- blocks pending A's commit

A: COMMIT;  -- B's DROP TABLE completes

A: SELECT tgrelid FROM pg_trigger WHERE tgname = 'footrig';tgrelid 
---------  66153
(1 row)

A: DROP FUNCTION foofunc();
ERROR:  cache lookup failed for relation 66153

Apparently the row in pg_trigger that A committed wasn't deleted
by B's DROP TABLE, presumably because B didn't have visibility to
to the trigger when its DROP TABLE statement began.  This case is
admittedly contrived but I did stumble across it in a test environment.

-- 
Michael Fuhr


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Function execution costs 'n all that
Следующее
От: Tom Lane
Дата:
Сообщение: Re: DROP FUNCTION failure: cache lookup failed for relation X