I'm trying to create the function -
CREATE OR REPLACE FUNCTION to_tstz_immutable(t text)
RETURNS timestamptz
LANGUAGE sql IMMUTABLE STRICT PARALLEL SAFE
$func$
BEGIN
RETURN date_trunc('hour', t);
END
$func$;
When I run this function I get below error -
ERROR: syntax error at or near "$func$
BEGIN
RETURN date_trunc('hour', t);
END
$func$" LINE 4: $func$ ^
SQL state: 42601 Character: 128
What is the problem with this function?