I got this working to return an integer:
CREATE FUNCTION my_function() RETURNS INTEGER AS $$
SELECT 1 AS result;
$$ LANGUAGE SQL;
But I want it to return a string, so I tweaked it to:
CREATE FUNCTION my_function() RETURNS TEXT AS $$
SELECT '1' AS result;
$$ LANGUAGE SQL;
But this fails with:
ERROR: return type mismatch in function declared to return text
DETAIL: Actual return type is unknown.
What happened? How can I return the string '1'?
unknown