Catalog indexer is broken when flat mode is turned on.
Local environment (containerised NGINX with lando) and hosting provided by platform sh
php bin/magento indexer:reindexSQLSTATE[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)
Hi @danharper83. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release
For more details, please, review the Magento Contributor Assistant documentation.
@danharper83 do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@magento-engcom-team give me 2.3-develop instance
Hi @danharper83. Thank you for your request. I'm working on Magento 2.3-develop instance for you
Hi @danharper83, here is your Magento instance.
Admin access: https://i-23003-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
I could not replicate this on a Vanilla install.
I think the problem with this query is that the WHERE (condition IS NOT NULL) should be WHERE ('condition' IS NOT NULL)
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)
Hi, can you provide me the instance for 2.2.8 ?
Yeah, try this in app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php line 368:
)->where("`$attributeCode` IS NOT NULL");
@danmooney2 it was an attribute called condition 馃う鈥嶁檪
I deleted the attribute on staging and it indexed successfully, I'm not sure how I can fix the attribute "condition" though.
@danharper83 condition is a reserved word in MySQL/MariaDB. Backticks (`) around the keyword would escape it and it would not be interpreted in a special manner by the parser; I think that's the correct change to make that I referenced above
Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Verify that the issue is reproducible on 2.2-develop branch. Details
- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x
[ ] 6. Add label Issue: Confirmed once verification is complete.
[ ] 7. Make sure that automatic system confirms that report has been added to the backlog.
HI @danharper83 thank you for you report, this issue has already fixed in 2.3-develop and 2.2-develop branch and available on 2.3.1 release and 2.2.9 release.
@engcom-backlog-nazar I can still replicate this issue on 2.2.9
Reopening as still and issue an 2.2.9 & 2.3.2
Hi @danielpfarmer. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[x] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
2.3-develop branch@magento give me 2.3-develop instance to deploy test instance on Magento infrastructure. 2.3-develop branch, please, add the label Reproduced on 2.3.x.Hello @danharper83
We are not able to reproduce this issue on the lates 2.3-develop branch.
So we have to close this issue.