Kevin Jenkins <gameprogrammer(at)rakkar(dot)org> writes:
> create or replace function IsUsedHandle(h text) returns boolean as $$
> declare
> begin
> select COUNT(*) as num_matches from handles where handles.handle = h;
> return num_matches > 0;
> end;
> $$ LANGUAGE plpgsql;
I think you've confused AS with INTO.
You forgot to declare num_matches as a local variable, too.
regards, tom lane