Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails
Date
Msg-id 16385.1322775178@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails  (Boszormenyi Zoltan <zb@cybertec.at>)
Responses Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-bugs
Boszormenyi Zoltan <zb@cybertec.at> writes:
> 2011-12-01 20:09 keltezéssel, rep.dot.nop@gmail.com í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.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Boszormenyi Zoltan
Date:
Subject: Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails