MDVA-15546: Column ‘entity_id’ where clause is ambiguous

The MDVA-15546 patch solves performance issues that may be related to some Amazon extensions. This issue in indicated by the following error in exception logs: where Column ‘entity_id’ in where clause is ambiguous, query was: SELECT `main_table`.*, `extension_attribute_amazon_order_reference_id `. This patch is available when the Quality Patches Tool (QPT) 1.0.20 is installed. The patch ID is MDVA-15546.

Affected products and versions

The patch is created for Adobe Commerce version:

Adobe Commerce on cloud infrastructure 2.2.5

Compatible with Adobe Commerce versions:

Adobe Commerce on cloud infrastructure 2.3.0 - 2.4.2

NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your Adobe Commerce version, update the magento/quality-patches package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.

Issue

Performance issues that may be related to some Amazon extensions.

Prerequisites:

Clean Adobe Commerce with B2B and Amazon_Payment.

Steps to reproduce:

  1. Go to the storefront page.
  2. Add product to the cart.
  3. Wait or trigger the cron job flush_preview_quotas.

Actual result:

When you check var/log/exception/log, you see following error:

report.ERROR: Cron Jobflush_preview_quotashas an error: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'entity_id' in where clause is ambiguous, query was: SELECT main_table.*, extension_attribute_amazon_order_reference_id.amazon_order_reference_idASextension_attribute_amazon_order_reference_id_amazon_order_reference_id, extension_attribute_amazon_order_reference_id.quote_idASextension_attribute_amazon_order_reference_id_quote_id, extension_attribute_amazon_order_reference_id. sandbox_simulation_referenceASextension_attribute_amazon_order_reference_id_sandbox_simulation_reference, extension_attribute_amazon_order_reference_id.confirmedASextension_attribute_amazon_order_reference_id_confirmedFROMquoteASmain_tableLEFT JOINamazon_quoteASextension_attribute_amazon_order_reference_id ON main_table.entity_id = extension_attribute_amazon_order_reference_id.quote_id WHERE ...

Expected result:

Cron Job completes without errors.

Apply the patch

To apply individual patches, use the following links depending on your deployment method:

To learn more about Quality Patches Tool, refer to:

For info about other patches available in QPT, refer to Patches available in QPT in our developer documentation.

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a