-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fix MySQL syntax error on indexation with certain attribute codes #22559
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
Conversation
Hi @Beagon. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Beagon, please do the following: #22113 (comment)
Hi @orlangur, I've backported the changes from 2.3-dev. Greetings, Robin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great @Beagon! 👍 Didn't expect it that fast taking into consideration discussion in previous PR)
Hi @orlangur, thank you for the review. |
✔️ QA passed |
Hi @Beagon, thank you for your contribution! |
Description
Fixes an issue where the category flat indexer would throw an MySQL syntax error if an attribute_code was equal to a MySQL function.
If you have a attribute with a code called "group" the following would occur when the catalog flat data indexer tries to run:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group IS NOT NULL)' at line 5, query was: UPDATE `catalog_product_flat_1_tmp_indexer` AS `et` LEFT JOIN `eav_attribute_option_value` AS `t0` ON t0.option_id = et.group AND t0.store_id = 0 LEFT JOIN `eav_attribute_option_value` AS `ts` ON ts.option_id = et.group AND ts.store_id = 1 SET `et`.`group_value` = IFNULL(ts.value, t0.value) WHERE (group IS NOT NULL)
Manual testing scenarios
Before patch:
php bin/magento indexer:reindex catalog_category_flat
After patch:
php bin/magento indexer:reindex catalog_category_flat
Contribution checklist