magento2: SQL error on 2.4.4 prerelease when saving a product with new source and stock

Preconditions (*)

  1. Magento 2.4.4 prerelease
  2. PHP 8.1
  3. Magento with prefix in DB

Steps to reproduce (*) 1.Create new source 2.Create new stock and assign for new source 4. Going to: Catalog–>Product–> Open random product, Assigning for new Source, add Q-ty 5. Push the Save button

Expected result (*)

  1. Success after save wtihout error, and seeing on the Products Greed Q-ty >0 in column Stock

Actual result (*)

  1. SQL Error and on the Products Grid in column Stock=0 and not displaying on FrontArea: https://imgur.com/a/Mj7vS0x https://imgur.com/a/POWJtKH SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘docker_mg244eegolaya.pref_reservations_temp_for_stock_2’ doesn’t exist, query was: SELECT source_item.sku, SUM(IF(source_item.status = 0, 0, source_item.quantity)) AS quantity, IF((reservations.reservation_qty IS NULL OR (SUM(source_item.quantity) + reservations.reservation_qty) > 0) AND (((legacy_stock_item.use_config_backorders = 0 AND legacy_stock_item.backorders <> 0) AND (legacy_stock_item.min_qty >= 0 OR legacy_stock_item.qty > legacy_stock_item.min_qty) AND SUM(IF(source_item.status = 0, 0, 1))) OR ((legacy_stock_item.use_config_manage_stock = 0 AND legacy_stock_item.manage_stock = 0)) OR ((legacy_stock_item.use_config_min_qty = 1 AND SUM(IF(source_item.status = 0, 0, source_item.quantity)) > 0) OR (legacy_stock_item.use_config_min_qty = 0 AND SUM(IF(source_item.status = 0, 0, source_item.quantity)) > legacy_stock_item.min_qty)) OR (product.sku IS NULL)), 1, 0) AS is_salable FROM pref_inventory_source_item AS source_item LEFT JOIN pref_catalog_product_entity AS product ON product.sku = source_item.sku AND (product.created_in <= 1 AND product.updated_in > 1) LEFT JOIN pref_cataloginventory_stock_item AS legacy_stock_item ON product.entity_id = legacy_stock_item.product_id LEFT JOIN pref_reservations_temp_for_stock_2 AS reservations ON source_item.sku = reservations.sku WHERE (source_item.source_code IN (‘a2’)) AND (source_item.sku IN (‘24-MB01’)) GROUP BY source_item.sku

Severity (*) S0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

The commit @engcom-Alfa mentioned doesn’t seem to be correct, this one seems a lot more related: https://github.com/magento/inventory/commit/d236405c22d3005c642c70348cfd372dbcb98b76