Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit efe431a

Browse files
committed
Fix naming condition for expression indexes
1 parent 70b7aa8 commit efe431a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wp-includes/sqlite-ast/class-wp-sqlite-information-schema-builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,11 +1876,11 @@ private function get_index_name( WP_Parser_Node $node ): string {
18761876
if ( null === $name_node ) {
18771877
/*
18781878
* In MySQL, the default index name equals the first column name.
1879-
* For functional indexes, the string "functional_index" is used.
1879+
* If any part is an expression, the name will be "functional_index".
18801880
* If the name is already used, we need to append a number.
18811881
*/
18821882
$subnode = $node->get_first_child_node( 'keyListVariants' )->get_first_child_node();
1883-
if ( 'exprWithParentheses' === $subnode->rule_name ) {
1883+
if ( null !== $subnode->get_first_descendant_node( 'exprWithParentheses' ) ) {
18841884
$name = 'functional_index';
18851885
} else {
18861886
$name = $this->get_value( $subnode->get_first_descendant_node( 'identifier' ) );

0 commit comments

Comments
 (0)