cache lookup failed for type 0
preethint opened this issue · 3 comments
preethint commented
Found below observation when trigger function returns scaler variable instead of TRIGGER.
Please refer below example, where I am getting cache lookup failed error in RETURN error.
create table t1 (v1 int);
CREATE OR REPLACE FUNCTION public.test_fun()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
declare
v1 int:=10;
BEGIN
update t1 set v1=10;
RETURN v1;
END;
$function$;
create or replace trigger trig1
before update on t1
for each row
execute function test_fun();
plpgsql_check_db@115226=#select * from plpgsql_check_function('test_fun()', 't1');
plpgsql_check_function
-----------------------------------------------------
error:XX000:6:RETURN:cache lookup failed for type 0
(1 row)
I think, here we should throw some meaningful error message.
preethint commented
Thanks.
okbob commented
thank you for bug report