Upgrade to B2B 1.5.2 fails with SQL syntax error due to missing REGEXP_LIKE function
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.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:
- 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.
- 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:
-
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
-
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.
-
Run
bin/magento setup:upgrade
.
Apply a patch using Cloud Patches
For ÃÛ¶¹ÊÓÆµ Commerce on Cloud infrastructures, follow the steps below:
-
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
-
Commit and push the changes to initiate re-deploy. Refer to Apply patches in our ÃÛ¶¹ÊÓÆµ Commerce on Cloud guide for instructions.