From: | Peter Willis <peterw(at)borstad(dot)com> |
---|---|
To: | Adrian Klaver <aklaver(at)comcast(dot)net> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: FUNCTION problem |
Date: | 2009-04-02 23:22:06 |
Message-ID: | 49D5489E.5010904@borstad.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Adrian Klaver wrote:
>
>
> Did you happen to catch this:
> Note that functions using RETURN NEXT or RETURN QUERY must be called as a table source in a FROM clause
>
> Try:
> select * from test_function(1)
>
I did miss that, but using that method to query the function
didn't work either. Postgres doesn't see the result as a
tabular set of records.
Even if I replace the FOR loop with:
<quote>
FOR R IN SELECT * FROM pg_database LOOP
RETURN NEXT R;
END LOOP;
</quote>
I get the same error(s). I don't think postgres likes
the unrelated 'SELECT INTO <variable> [column] FROM [QUERY] LIMIT 1'
lines before the FOR loop...
I think I need to go back and approach the function from a
different direction.
Thanks for all the pointers.
Peter
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2009-04-03 01:16:44 | Re: FUNCTION problem |
Previous Message | Tom Lane | 2009-04-02 23:01:21 | Re: How would I get rid of trailing blank line? |