Obviously,
this part of tr_f_def():
******************************
-- delete the contents
-- delete from f;
IF EXISTS (SELECT 1 FROM f) THEN
DELETE FROM F;
VACUUM F;
END IF;
******************************
should simply read:
******************************
-- delete the contents
delete from f;
******************************
--
Best,
Frank.