From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Raphael Bauduin <raphael(dot)bauduin(at)be(dot)easynet(dot)net> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: set-returning function in pg 7.4.6 |
Date: | 2005-03-14 16:06:52 |
Message-ID: | 20050314160652.GA45430@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Mon, Mar 14, 2005 at 04:50:38PM +0100, Raphael Bauduin wrote:
> for r in EXECUTE ''select customer_id from customers'' loop
If the query is static (i.e., not generated) and you're not working
with a temporary table, then you can omit EXECUTE:
FOR r IN SELECT customer_id FROM customers LOOP
The function might benefit from using a cached plan in this case.
> select GetRows();
>
> I get this error:
>
> ERROR: set-valued function called in context that cannot accept a set
> CONTEXT: PL/pgSQL function "getrows" line 5 at return next
It should be:
SELECT * FROM GetRows();
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Travers | 2005-03-14 17:50:09 | Re: sql question |
Previous Message | Stephan Szabo | 2005-03-14 15:55:51 | Re: set-returning function in pg 7.4.6 |