I am getting a very small but irritating error while creating a Postgres function.
The function get executed when my language is sql but throws a syntax error
syntax error at or near "Select" LINE 14: Select * from x*
when I change the language to plpgsql, as I need to use control statements I need my language to be plpgsql not sql.
Here is the function defination
-- FUNCTION: public."HHMD"()
DROP FUNCTION public."HHMD"();
CREATE OR REPLACE FUNCTION public."HHMD"(
)
RETURNS TABLE(changesets character varying)
LANGUAGE 'plpgsql'
COST 100
VOLATILE
ROWS 1000
AS $BODY$
Select * from x
$BODY$;
ALTER FUNCTION public."HHMD"()
OWNER TO lke_new;
COMMENT ON FUNCTION public."HHMD"()
IS 'work!';