Excerpts from Tom Lane's message of jue dic 01 18:32:58 -0300 2011:
> Boszormenyi Zoltan <[email protected]> writes:
> > 2011-12-01 20:09 keltezéssel, [email protected] írta:
> >> Binding for "OFFSET :offset" works fine but binding for a
> >> "FETCH NEXT :next
> >> ROWS ONLY" raises:
> >> syntax error at or near "$2"
> >> SELECT * FROM foo OFFSET $1 ROWS FETCH NEXT $2 ROWS ONLY
>
> > This is not a supported syntax. Consider using
> > SELECT * FROM foo OFFSET $1 LIMIT $2
> > instead.
>
> Well, actually it is supported, but you missed the fine print where it
> says that you have to add parentheses if the offset or count isn't a
> simple integer constant. I'll apply a patch to make that a bit more
> obvious.
Hmm, it works with parens only in the "fetch next" clause, they don't
seem necessary in the limit. FWIW.
alvherre=# prepare foo(int, int) as select * from generate_series(1, 200)
offset $1 fetch next ($2) rows only;
PREPARE
alvherre=# execute foo(2+3, 1+2);
generate_series
-----------------
6
7
8
(3 filas)
--
Álvaro Herrera <[email protected]>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
--
Sent via pgsql-bugs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs