From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Boszormenyi Zoltan <zb@cybertec.at>
Cc: Pg Bugs <pgsql-bugs@postgresql.org>
Cc: rep.dot.nop <rep.dot.nop@gmail.com>
Subject: Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails
Date: Thu, 01 Dec 2011 17:06:04 -0500
Message-ID: <18845.1322777164@sss.pgh.pa.us> (raw)
In-Reply-To: <1322776151-sup-3519@alvh.no-ip.org>
References: <E1RWC0F-0000xy-Bh@wrigleys.postgresql.org>
<4ED7E66D.9090701@cybertec.at>
<16385.1322775178@sss.pgh.pa.us>
<1322776151-sup-3519@alvh.no-ip.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@commandprompt.com, zb@cybertec.at, rep.dot.nop@gmail.com
Subject: Re: BUG #6315: FETCH NEXT :next ROWS ONLY fails
In-Reply-To: <18845.1322777164@sss.pgh.pa.us>
References: <E1RWC0F-0000xy-Bh@wrigleys.postgresql.org> <4ED7E66D.9090701@cybertec.at> <16385.1322775178@sss.pgh.pa.us> <1322776151-sup-3519@alvh.no-ip.org> <18845.1322777164@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox