postgreSQL Fibonacci Sequence - Query has no destination for result data
问题 So I wrote a Fibonacci sequence function like this: CREATE OR REPLACE FUNCTION fibonacci (lastN INTEGER) RETURNS int AS $$ BEGIN WITH RECURSIVE t(a, b) AS ( VALUES(0,1) UNION ALL SELECT GREATEST(a, b), a + b AS a from t WHERE b < $1 ) SELECT a FROM t; END; $$ LANGUAGE plpgsql; But when I called: SELECT * FROM fibonacci(20); the console shows: ERROR: query has no destination for result data HINT: If you want to discard the results of a SELECT, use PERFORM instead. CONTEXT: PL/pgSQL function