From: Peter Willis <peterw@borstad.com>
To: Adrian Klaver <aklaver@comcast.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: FUNCTION problem
Date: Thu, 02 Apr 2009 16:22:06 -0700
Message-ID: <49D5489E.5010904@borstad.com> (raw)
In-Reply-To: <1521645855.2691471238710811603.JavaMail.root@sz0030a.emeryville.ca.mail.comcast.net>
References: <1521645855.2691471238710811603.JavaMail.root@sz0030a.emeryville.ca.mail.comcast.net>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: peterw@borstad.com, aklaver@comcast.net
Subject: Re: FUNCTION problem
In-Reply-To: <49D5489E.5010904@borstad.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox