parser
parser copied to clipboard
Support the SQL:2008 Standard `OFFSET m ROWS FETCH FIRST n ROWS` clause
Feature Request
Is your feature request related to a problem? Please describe:
SQL:2008 introduced the FETCH FIRST clause to unify the LIMIT feature with varying syntax among all RDBMS (CD 9075-2:201X §7.16/6–7). This feature is supported in PostgreSQL, DB2 and Oracle. Users migrating from outside MySQL may find it more natural to use the standard syntax than LIMIT. (see also https://bugs.mysql.com/bug.php?id=78929.)
Describe the feature you'd like:
Parse the clause:
[ OFFSET m { ROW | ROWS } ]
[ FETCH { FIRST | NEXT } [ n ] { ROW | ROWS } ONLY ]
as equivalent to
LIMIT n OFFSET m
(if n
is missing it default to 1)
(FIRST and NEXT are synonyms)
Describe alternatives you've considered:
Don't support it.
Teachability, Documentation, Adoption, Migration Strategy:
Sounds an interesting feature :)
After discussion with kennytm, I'll only support FETCH { FIRST | NEXT } [ n ] { ROW | ROWS } ONLY
part in #985 for now because it seems very complicated to support the [ OFFSET m { ROW | ROWS } ]
part.