I am trying to create a function inside Postgres. For some reason my query works perfectly fine when I run it from inside the Query tool. Once I added the query to my function, I get the error
ERROR: syntax error at or near "DELETE"
Not sure what is the problem.
CREATE FUNCTION public.remove_email_header()
RETURNS pg_trigger
LANGUAGE 'plpgsql'
AS $BODY$
DELETE FROM public.spam_dictionary WHERE words LIKE '%FROM%';
$BODY$;
ALTER FUNCTION public.remove_email_header()
OWNER TO postgres;