I have a problem with PostgreSQL. I want to create a trigger and trigger function in a single query, so I can make trigger in a faster way.
this is my trigger function:
CREATE FUNCTION public.tda_a1()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 100.0
VOLATILE NOT LEAKPROOF
COST 100.0
AS $BODY$
BEGIN
DELETE FROM ref_dati2 where kd_propinsi = OLD.kd_propinsi;
RETURN OLD;
END;
$BODY$;
And this is the trigger :
CREATE TRIGGER tda_a1
BEFORE DELETE
ON public.ref_propinsi
FOR EACH ROW
EXECUTE PROCEDURE public.tda_a1();
I have tried to join those into a single query but failed. Maybe someone can help me.
xxx secret :
Thank you for all your answers but finally I have found the answer,\nI just removed this script from my query.\n\n NOT LEAKPROOF \n COST 100.0\n\n\nthat is the default from pgadmin, when I removed it I can run trigger an trigger function in a single query as many as I want",
2017-06-23T04:05:54