Skip to content

Fix keys mixing columns and functional key parts - #687

Open
Niksac wants to merge 1 commit into
phpmyadmin:5.11.xfrom
Niksac:fix-mixed-functional-key-parts
Open

Niksac wants to merge 1 commit into
phpmyadmin:5.11.xfrom
Niksac:fix-mixed-functional-key-parts

Conversation

@Niksac

@Niksac Niksac commented Nov 2, 2026

Copy link
Copy Markdown

Fixes #640
Also fixes phpmyadmin/phpmyadmin#18236

A key mixing columns and functional key parts lost its expressions
when built, e.g. UNIQUE KEY u (a,(IFNULL(c,'x'))) was exported as
(a,(x)). Each functional key part is now parsed as its own entry in
Key::$columns (with optional ASC/DESC). Keys made of expressions
only still use Key::$expr, so existing behaviour stays the same.

Disclosure: most of the patch was written by Claude, then reviewed and tested by me.

After a column, a functional key part like (IFNULL(c,'x')) was
read as a column length and its expression was lost when building
the statement, so phpMyAdmin exported a broken index.

Each functional key part is now its own entry in Key::$columns.
Keys made of expressions only still use Key::$expr.

Fixes phpmyadmin#640

Signed-off-by: nik <nik@zendri.com>
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