You unexpectedly came across this function) Recording requires two or more fields. Therefore, when you have only one out variable, the result should be scalar.
So you can just do what the compilers ask)
CREATE OR REPLACE FUNCTION GetNumberOne(
OUT numberone bigint)
RETURNS bigint AS
$BODY$
SELECT CAST(1 AS BIGINT) AS "NUMBERONE";
$BODY$
LANGUAGE sql VOLATILE;
Plpgsql example:
CREATE OR REPLACE FUNCTION NumberOne()
RETURNS bigint AS
$BODY$
DECLARE num bigint;
BEGIN
num := 1;
RETURN num;
END
$BODY$
LANGUAGE plpgsql VOLATILE;
select * from NumberOne()
source
share