I want to create a function that returs the number of records from a postgres database such as the following. The sql is dynamic as the table is created as the table is a partition.
CREATE OR REPLACE FUNCTION "public"."function1" (TEXT) RETURNS INTEGER AS
vText ALIAS FOR $1;
vSQL:= 'select count(*) from table'||$1;
vresult:= EXECUTE vSQL;
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
What's wrong with my function.