create or replace function fibonacci(int) returns int
as $$
declare
a int;
res int := 0;
begin
a := $1;
if(a = 1 or a = 2) then
res :=1;
else
res := fibonacci(a - 2) + fibonacci(a - 1);
end if;
return res;
end;
language plpgsql;
The error message that shows and I do not see the error since I probe in several ways the same continues to show is a fibonacci sequence
ERROR: una cadena separada por $ está inconclusa en o cerca de «$$
declare
a int;
res int := 0;
begin
a := $1;
if(a = 1 or a = 2) then
res :=1;
else
res := fibonacci(a - 2) + fibonacci(a - 1);
end if;
return res;
end;
language plpgsql;»
LINE 3: as $$
^
SQL state: 42601
Character: 106