plan cache doesn't clean plans with references to dropped procedures
От | Pavel Stehule |
---|---|
Тема | plan cache doesn't clean plans with references to dropped procedures |
Дата | |
Msg-id | CAFj8pRBc4ksLgOAaSCX2uvZ3aNqW1NV1g=PZ+f2_+trpEyDJEw@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: plan cache doesn't clean plans with references to dropped procedures
|
Список | pgsql-hackers |
Hi
I am playing with fixing the speed of CALL statement in a non atomic context, and when I tested my patch I found another issue of CALL statement - an invalidation of plans doesn't work for CALL statement (in atomic context).
CREATE OR REPLACE FUNCTION public.fx(a integer)
RETURNS integer
LANGUAGE plpgsql
AS $function$
begin
return a;
end;
$function$
create or replace function fxo(a int)
returns int as $$
begin
return fx(a);
end;
$$ language plpgsql;
drop function fx;
-- create fx again
create or replace function fx(a int)
returns int as $$
begin
return a;
end;
$$ language plpgsql;
-- should be ok
select fxo(10);
-- but
create procedure pe(a int)
as $$
begin
end;
$$ language plpgsql;
create or replace function fxo(a int)
returns int as $$
begin
call pe(a);
return fx(a);
end;
$$ language plpgsql;
-- ok
select fxo(10);
postgres=# drop procedure pe;
DROP PROCEDURE
postgres=# create procedure pe(a int)
as $$
begin
end;
$$ language plpgsql;
CREATE PROCEDURE
postgres=# select fxo(10);
ERROR: cache lookup failed for function 16389
CONTEXT: SQL statement "CALL pe(a)"
PL/pgSQL function fxo(integer) line 2 at CALL
RETURNS integer
LANGUAGE plpgsql
AS $function$
begin
return a;
end;
$function$
create or replace function fxo(a int)
returns int as $$
begin
return fx(a);
end;
$$ language plpgsql;
drop function fx;
-- create fx again
create or replace function fx(a int)
returns int as $$
begin
return a;
end;
$$ language plpgsql;
-- should be ok
select fxo(10);
-- but
create procedure pe(a int)
as $$
begin
end;
$$ language plpgsql;
create or replace function fxo(a int)
returns int as $$
begin
call pe(a);
return fx(a);
end;
$$ language plpgsql;
-- ok
select fxo(10);
postgres=# drop procedure pe;
DROP PROCEDURE
postgres=# create procedure pe(a int)
as $$
begin
end;
$$ language plpgsql;
CREATE PROCEDURE
postgres=# select fxo(10);
ERROR: cache lookup failed for function 16389
CONTEXT: SQL statement "CALL pe(a)"
PL/pgSQL function fxo(integer) line 2 at CALL
Regards
Pavel
В списке pgsql-hackers по дате отправления: