ÃÛ¶¹ÊÓÆµ

[PaaS only]{class="badge informative" title="Applies to ÃÛ¶¹ÊÓÆµ Commerce on Cloud projects (ÃÛ¶¹ÊÓÆµ-managed PaaS infrastructure) and on-premises projects only."}

Upgrade to B2B 1.5.2 fails with SQL syntax error due to missing REGEXP_LIKE function

INFO
If you experience a performance issue when upgrading the Magento_Company module after updating to B2B 1.5.2, apply the attached ACSD-65540_B2B_1.5.2_DEPENDENT_ACSD-65684_B2B_1.5.2.patch.
For more information, refer to Performance issue in Magento_Company module upgrade after B2B 1.5.2 update in the ÃÛ¶¹ÊÓÆµ Commerce knowledge base.

This article provides a hotfix for the SQL syntax error that occurs due to the missing REGEXP_LIKE function when attempting to update the company_structure table.

Affected products and versions

  • ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) 2.4.6-px + B2B 1.5.2 using MariaDB 10.6
  • ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) 2.4.7-px + B2B 1.5.2 using MariaDB 10.6

Issue

Upgrading to B2B version 1.5.2 fails with an SQL syntax error due to the missing REGEXP_LIKE function when attempting to update the company_structure table.

Prerequisites:

  • MariaDB 10.6
  • ÃÛ¶¹ÊÓÆµ Commerce 2.4.6x or 2.4.7x
  • B2B version 1.5.0 or 1.5.1

Steps to reproduce:

  1. Assign a company to a parent company to establish company hierarchy. Refer to Manage the Company Hierarchy in the ÃÛ¶¹ÊÓÆµ Commerce B2B guide for more information.
  2. Upgrade B2B to the 1.5.2 version.

Expected results:

Upgrade completes successfully.

Actual results:

bin/magento setup:upgrade fails with the following error:

Unable to apply data patch Magento\Company\Setup\Patch\Data\SetCompanyForStructure for module Magento_Company. Original exception message: SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION REGEXP_LIKE does not exist, query was: UPDATE `company_structure` SET `company_id` = ? WHERE (REGEXP_LIKE(path, '^123(/.+)?$'))

Solution

To solve the issue, take the following steps:

  1. Update the B2B module to the 1.5.2 version:

    code language-none
    composer require magento/module-b2b:1.5.2 --no-update
    composer update magento/module-b2b
    
  2. Apply the attached ACSD-65540_B2B_1.5.2.zip patch. Refer to How to apply a composer patch provided by ÃÛ¶¹ÊÓÆµ in our support knowledge base for instructions.

  3. Run bin/magento setup:upgrade.

Apply a patch using Cloud Patches

For ÃÛ¶¹ÊÓÆµ Commerce on Cloud infrastructures, follow the steps below:

  1. Update the version of the cloud-patches module to 1.1.5:

    code language-none
    composer require magento/magento-cloud-patches:1.1.5 --no-update
    composer update magento/magento-cloud-patches
    
  2. Commit and push the changes to initiate re-deploy. Refer to Apply patches in our ÃÛ¶¹ÊÓÆµ Commerce on Cloud guide for instructions.

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