Re: set-returning function in pg 7.4.6

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: set-returning function in pg 7.4.6
Дата
Msg-id 20050314160652.GA45430@winnie.fuhr.org
обсуждение исходный текст
Ответ на set-returning function in pg 7.4.6  (Raphael Bauduin <raphael.bauduin@be.easynet.net>)
Список 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/

В списке pgsql-novice по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: set-returning function in pg 7.4.6
Следующее
От: "Christian Hofmann"
Дата:
Сообщение: Problem: Joining each column of a "one row query" with the result of a "many row query"