Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Pg Bugs <pgsql-bugs(at)postgresql(dot)org>, "rep(dot)dot(dot)nop" <rep(dot)dot(dot)nop(at)gmail(dot)com>
Subject: Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails
Date: 2011-12-01 22:06:04
Message-ID: 18845.1322777164@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Excerpts from Tom Lane's message of jue dic 01 18:32:58 -0300 2011:
>> 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.

ITYM "offset"? You do need the parens if you want to spell it
SQL:2008's way, with the ROW/ROWS noise word.

regression=# select * from int8_tbl offset 2+2;
q1 | q2
------------------+-------------------
4567890123456789 | -4567890123456789
(1 row)

regression=# select * from int8_tbl offset 2+2 rows;
ERROR: syntax error at or near "rows"
LINE 1: select * from int8_tbl offset 2+2 rows;
^
regression=# select * from int8_tbl offset (2+2) rows;
q1 | q2
------------------+-------------------
4567890123456789 | -4567890123456789
(1 row)

The comment in gram.y says there are parsing conflicts if we try to not
require the parens, and that SQL:2008 doesn't actually require anything
beyond a simple integer constant here.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message postgresql 2011-12-02 06:21:27 BUG #6316: function search_path causes set_config() is_local = true to have no effect
Previous Message Bernhard Reutner-Fischer 2011-12-01 22:04:14 Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails