Re: cursors as table sources

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: cursors as table sources
Дата
Msg-id 20060111182430.GA86729@winnie.fuhr.org
обсуждение исходный текст
Ответ на cursors as table sources  ("Peter Filipov" <pfilipov@netissat.bg>)
Ответы Re: cursors as table sources  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: cursors as table sources  (Will Glynn <wglynn@freedomhealthcare.org>)
Список pgsql-general
On Wed, Jan 11, 2006 at 04:11:18PM +0200, Peter Filipov wrote:
> Is the idea to use cursors as table sources good?
> Do you plan to implement it in the future and if you plan will it be soon?

Do you mean the ability to use a cursor as one of the sources in
the FROM clause?  Something like the following non-working examples?

  DECLARE curs CURSOR FOR SELECT * FROM table1;
  SELECT * FROM table2, curs;

or

  DECLARE curs CURSOR FOR SELECT * FROM table1;
  SELECT * FROM table2, (FETCH ALL FROM curs) AS s;

As far as I know PostgreSQL doesn't allow anything like that;
somebody please correct me if I'm mistaken.  However, you could
write a set-returning function that takes a refcursor argument and
iterates through the cursor, returning each row, and use that
function in the FROM clause.  Whether that's a good idea or not is
something I haven't given much thought to.  Is there a reason you'd
want to use a cursor instead of, say, a view?

Are you just curious or is there a problem you're trying to solve?
If I've misunderstood what you're asking then please elaborate.

--
Michael Fuhr

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Connection specific information - Temporary table used
Следующее
От: Marcos
Дата:
Сообщение: Create Produre for DROP row