Fix SQL:2008 FETCH FIRST syntax to allow parameters.
authorAndrew Gierth
Mon, 21 May 2018 16:02:17 +0000 (17:02 +0100)
committerAndrew Gierth
Mon, 21 May 2018 16:27:08 +0000 (17:27 +0100)
commit1da162e1f5a783bd0ce26e6a07c0138dc8a47d44
tree33ee0d0c53b3abef755704fddf4680a0db94e1c0
parent806d08c0489f72282e0a25629e0d6054176e0c9d
Fix SQL:2008 FETCH FIRST syntax to allow parameters.

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

Rectify that by making  and  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/[email protected]
Discussion: http://postgr.es/m/152647780335.27204.16895288237122418685@wrigleys.postgresql.org
doc/src/sgml/ref/select.sgml
src/backend/parser/gram.y