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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails
Дата
Msg-id 18845.1322777164@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-bugs
Alvaro Herrera <alvherre@commandprompt.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

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails
Следующее
От: Bernhard Reutner-Fischer
Дата:
Сообщение: Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails