-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Attributes named like mysql reserved keywords will break flat catalog indexing #22113
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
… indexing Having a product attribute named condition or some other mysql reserved keyword will result in an error while indexing flat catalog: Ex: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'condition 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.condition AND t0.store_id = 0 LEFT JOIN `eav_attribute_option_value` AS `ts` ON ts.option_id = et.condition AND ts.store_id = 1 SET `et`.`condition_value` = IFNULL(ts.value, t0.value) WHERE (condition IS NOT NULL)
Attributes named like mysql reserved keywords will break flat catalog…
Hi @florinsith. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@florinsith any contribution should be delivered to |
The 2.3-develop code is different and weird but I dont think it has an issue. By looking at the code it should result in something like: ..... As you notice the attribute code is replaced by that ifnull function in the where condition. So I guess its just the 2.2 branch, |
@florinsith ok, then corresponding changes needs to be backported from |
Closing due to inactivity. Feel free to reach me out anytime later if you wish to continue work on this pull request and it will be reopened. |
Hi @florinsith, thank you for your contribution! |
I dont really understand what you mean, I am not familiar with this flow. How would I make the change on 2.3-develop since that has different code? |
@florinsith you need to find commits where fixed logic was introduced for |
Description (*)
Having a product attribute named condition or some other mysql reserved keyword will result in an error while indexing flat catalog:
Ex:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'condition 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.condition AND t0.store_id = 0
LEFT JOIN eav_attribute_option_value AS ts ON ts.option_id = et.condition AND ts.store_id = 1
SET et.condition_value = IFNULL(ts.value, t0.value)
WHERE (condition IS NOT NULL)
Fixed Issues (if relevant)
Fixes flat catalog indexing for that scenario