Skip to content

Conversation

@mvzink
Copy link
Contributor

@mvzink mvzink commented Jan 23, 2026

Adds support for MySQL-specific SELECT modifiers that appear after the SELECT keyword. Grammar from the docs:

SELECT
    [ALL | DISTINCT | DISTINCTROW ]
    [HIGH_PRIORITY]
    [STRAIGHT_JOIN]
    [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
    [SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
    select_expr [, select_expr] ...

Manual testing shows that these options can appear in any order relative to each other, so for the sake of fidelity, we parse this separately from how we parse distinct and other options for other dialects, in a new Parser::parse_select_modifiers method.

DISTINCTROW is a legacy (but not deprecated) synonym for DISTINCT, so it just gets canonicalized as DISTINCT.

Adds support for MySQL-specific `SELECT` modifiers that appear after the
`SELECT` keyword. Grammar from the [docs]:

```sql
SELECT
    [ALL | DISTINCT | DISTINCTROW ]
    [HIGH_PRIORITY]
    [STRAIGHT_JOIN]
    [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
    [SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
    select_expr [, select_expr] ...
```

Manual testing shows that these options can appear in any order relative
to each other, so for the sake of fidelity, we parse this separately
from how we parse distinct and other options for other dialects, in a
new `Parser::parse_select_modifiers` method.

`DISTINCTROW` is a legacy (but not deprecated) synonym for `DISTINCT`,
so it just gets canonicalized as `DISTINCT`.

[docs]: https://dev.mysql.com/doc/refman/8.4/en/select.html
@mvzink mvzink force-pushed the push-syxoqlsrvqux branch from 460f829 to a437a32 Compare January 23, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant