FETCH in subqueries or CTEs

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема FETCH in subqueries or CTEs
Дата
Msg-id 5036DA66.1060409@ringerc.id.au
обсуждение исходный текст
Ответы Re: FETCH in subqueries or CTEs  (Jeff Davis <pgsql@j-davis.com>)
Re: FETCH in subqueries or CTEs  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-general
Hi all

I've noticed that FETCH doesn't seem to be supported in subqueries or in
CTEs.

Is there a specific reason for that, beyond "nobody's needed it and
implemented it"? I'm not complaining at all, merely curious.

A toy example:

     DECLARE somecursor CURSOR FOR SELECT generate_series(1,1000)
     SELECT * FROM ( FETCH ALL FROM somecursor ) x;

produces:

     ERROR:  syntax error at or near "FETCH"
     LINE 1: SELECT * FROM ( FETCH ALL FROM somecursor ) x;
                         ^
Same with a CTE:

      WITH x AS ( FETCH ALL FROM somecursor ) SELECT * FROM x;

ERROR:  syntax error at or near "FETCH"
LINE 1: WITH x AS ( FETCH ALL FROM somecursor ) SELECT * FROM x;

--
Craig Ringer


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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: At what point does a big table start becoming too big?
Следующее
От: Chris Travers
Дата:
Сообщение: Re: Some thoughts on table inheritance (which is uniquely awesome on PostgreSQL)