What is the best way to parameterize interval date type in a PostgreSQL function?. I have the following function
CREATE OR REPLACE FUNCTION testing(
min_time integer
)
RETURNS void AS
$BODY$
BEGIN
EXECUTE format('CREATE TABLE foo AS
SELECT
gid,
now() + concat(%s, ' hours')::interval as x,
FROM foobar
limit 3 ',min_time );
END;
$BODY$
LANGUAGE plpgsql;
Each time I try to execute the function I get the following error ERROR: syntax error at or near "hours"