Is it possible to create a new function from another plpgsql function? Something like this:
CREATE OR REPLACE FUNCTION func_test()
RETURNS VOID AS
$BODY$
BEGIN
CREATE OR REPLACE FUNCTION func_test2()
RETURNS INT AS
BEGIN
$$
SELECT 1;
$$
END
END
$BODY$
LANGUAGE plpgsql;
When I execute the code above I get:
ERROR: unexpected end of function definition at end of input LINE 13: $BODY$`