Aww, I was really close :) ... thanks, that works. I believe I understand it now :) Do you normally write functions in plpgsql or a different language (sql, perl, c)? I ask so I should know where to focus my learning.
Thanks,
Nick
On 5/31/05, Tom Lane <tgl@sss.pgh.pa.us> wrote: Nick Jones <neckjonez@gmail.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
--
Thanks,
Nick