]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix SQL:2008 FETCH FIRST syntax to allow parameters.
authorAndrew Gierth <rhodiumtoad@postgresql.org>
Mon, 21 May 2018 16:02:17 +0000 (17:02 +0100)
committerAndrew Gierth <rhodiumtoad@postgresql.org>
Mon, 21 May 2018 16:32:34 +0000 (17:32 +0100)
commit89b09db01b4323b3fb07384257373e02719f7573
treee93a3fac1e2daf6ba8aeecd98de1c26962cd7d0f
parent0aa97b86f9021f2d4a5cd1aab04e0d33794d120b
Fix SQL:2008 FETCH FIRST syntax to allow parameters.

OFFSET <x> ROWS FETCH FIRST <y> ROWS ONLY syntax is supposed to accept
<simple value specification>, which includes parameters as well as
literals. When this syntax was added all those years ago, it was done
inconsistently, with <x> and <y> being different subsets of the
standard syntax.

Rectify that by making <x> and <y> accept the same thing, and allowing
either a (signed) numeric literal or a c_expr there, which allows for
parameters, variables, and parenthesized arbitrary expressions.

Per bug #15200 from Lukas Eder.

Backpatch all the way, since this has been broken from the start.

Discussion: https://postgr.es/m/877enz476l.fsf@news-spur.riddles.org.uk
Discussion: http://postgr.es/m/152647780335.27204.16895288237122418685@wrigleys.postgresql.org
doc/src/sgml/ref/select.sgml
src/backend/parser/gram.y