Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix #592 - desc index #636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
predictor2718 wants to merge 5 commits into phpmyadmin:6.0.x
base: 6.0.x
Choose a base branch
Loading
from predictor2718:fix-592-desc-index

Conversation

@predictor2718
Copy link

@predictor2718 predictor2718 commented Nov 24, 2025

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.

...admin#592)
Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
@williamdes williamdes changed the title (削除) Fix 592 desc index (削除ここまで) (追記) Fix #592 - desc index (追記ここまで) Nov 25, 2025
Copy link
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR, I am not too sure about using the in array check
Would DeSC still trigger this ?

predictor2718 reacted with thumbs up emoji
Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
Copy link
Author

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 DESC columns

All tests pass with the current implementation.

williamdes reacted with rocket emoji

['parser/parseAlterTableAddSpatialIndex1'],
['parser/parseAlterTableAddUniqueKey1'],
['parser/parseAlterTableAddUniqueKey2'],
['parser/parseAlterTableAddUniqueKeyDesc'],
Copy link
Member

@williamdes williamdes Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is test files missing here

Also, maybe add an col1 ASC, col2 DESC test?

Copy link
Author

@predictor2718 predictor2718 Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your reply and Happy New Year!

I have linked the files and added an Asc-Desc and Desc-Asc test.

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@williamdes williamdes williamdes approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /