Skip to content

[B2B] Issue with REGEXP_LIKE on mariadb on Magento_Company #39804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 5 tasks
lohoy opened this issue Apr 10, 2025 · 7 comments
Open
1 of 5 tasks

[B2B] Issue with REGEXP_LIKE on mariadb on Magento_Company #39804

lohoy opened this issue Apr 10, 2025 · 7 comments
Labels
Reported on 2.4.6-p10 Indicates original Magento version for the Issue report.

Comments

@lohoy
Copy link

lohoy commented Apr 10, 2025

Preconditions and environment

We have an issue on Magento 2.4.6-p10 with vendor/magento/module-company/Setup/Patch/Data/SetCompanyForStructure.php.

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 magento2.REGEXP_LIKE does not exist, query was: UPDATE `company_structure` SET `company_id` = ? WHERE (REGEXP_LIKE(path, '^1(/.+)?$'))

The SQL query use REGEXP_LIKE but it's not implemented on MariaDB 10.6.

I change the patch to use REGEXP instead of REGEXP_LIKE.

Can you fix this issue because Magento recommande MariaDB and use MariaDB on cloud projects.

Cordially.

Steps to reproduce

Update Magento_Company module to 102.0.2.
bin/magento setup:upgrade

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 magento2.REGEXP_LIKE does not exist, query was: UPDATE `company_structure` SET `company_id` = ? WHERE (REGEXP_LIKE(path, '^1(/.+)?$'))

Expected result

Setup upgrade success

Actual result

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 magento2.REGEXP_LIKE does not exist, query was: UPDATE `company_structure` SET `company_id` = ? WHERE (REGEXP_LIKE(path, '^1(/.+)?$'))

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Apr 10, 2025

Hi @lohoy. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@nicolas-medina
Copy link
Member

Using REGEXP:

['path ?' => new \Zend_Db_Expr('REGEXP \'^' . $adminStructureIds[$company['super_user_id']]['structure_id'] . '(/.+)?$\'')]

@engcom-Bravo engcom-Bravo added the Reported on 2.4.6-p10 Indicates original Magento version for the Issue report. label Apr 14, 2025
@lohoy
Copy link
Author

lohoy commented Apr 14, 2025

Hello @nicolas-medina,

Thanks for your reponse, I use REGEXP to fix this issue.

Cordially.

@rshkembi
Copy link

The same issue happens on 2.4.7-p5 EE version

@hostep
Copy link
Contributor

hostep commented Apr 15, 2025

Looks like there is a patch for this problem: magento/magento-cloud-patches@4d69738

@prince-prc
Copy link

The same issue for upgrading "EE" version 2.4.6-p8 to 2.4.6-p10, mariadb 10.6 v

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 magento_db.REGEXP_LIKE does not exist, query was: UPDATE `company_structure` SET `company_id` = ? WHERE (REGEXP_LIKE(path, '^1(/.+)?$'))

@nicolas-medina
Copy link
Member

@prince-prc

Upgrade B2B module or install this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reported on 2.4.6-p10 Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests

6 participants