Fix #592 - desc index
Description
This PR fixes incorrect parsing of DESC inside index definitions in
ALTER TABLE statements.
Example:
ALTER TABLE `t`
ADD UNIQUE KEY `idx` (`a`, `b` DESC);
This change updates AlterOperation::parse() so that ASC and DESC are not interpreted as new statements within index definitions.
Fixes #592.
Thank you for the review!
Regarding the question about whether DeSC (or other mixed-case variants) would still trigger the check:
The parser normalizes keywords during lexing.
Lexer::parseKeyword() internally calls Context::isKeyword(), which performs a strtoupper() on the token value.
Because of this, any case variation like DESC, Desc, DeSC, etc. is always mapped to the uppercase keyword DESC.
So the condition is case-insensitive and mixed-case inputs won’t cause issues.
To be safe, I also added additional tests covering:
-
ASC -
DESC - lowercase
desc - two
DESCcolumns
All tests pass with the current implementation.