I am trying to create a trigger in Supabase with the following code that will help me update a certain value in another table. Following is the trigger code for the supabase function
BEGIN
DECLARE num integer;
SELECT count(*) into num FROM chapters
WHERE seriesid=new.seriesid;
INSERT INTO public.series(chapcount);
WHERE id=new.seriesid;
values(num);
RETURN new;
END;
However, I get the following error Failed to create function: Syntax error at or near "*"