Nick Jones <neckjonez(at)gmail(dot)com> writes:
> CREATE FUNCTION test2(VARCHAR) RETURNS SETOF TEXT AS
> '
> DECLARE
> r record;
> BEGIN
> FOR r IN
> select router_name from router where router_name ~ $1
> LOOP
> RETURN NEXT r;
> END LOOP;
> RETURN;
> END;
> ' LANGUAGE 'plpgsql';
Close, but you want "RETURN NEXT r.router_name". r is a record
potentially containing several fields, you have to say which you
want.
regards, tom lane