From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: FETCH in subqueries or CTEs |
Date: | 2012-08-24 04:34:04 |
Message-ID: | CAFj8pRB3NjnFVk2dD_qSLNzA8AJbCU+E29hbEPStnjyw1WNM_g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
2012/8/24 Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>:
> 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;
>
you can't mix planned and unplanned statements together - think about
stored plans every time
Regards
Pavel
> --
> Craig Ringer
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
From | Date | Subject | |
---|---|---|---|
Next Message | Jason Dusek | 2012-08-24 09:32:32 | Re: Rules, Windows and ORDER BY |
Previous Message | Sébastien Lorion | 2012-08-24 04:22:47 | Re: Amazon High I/O instances |