Skip to content

[Compatibility]: REGEXP match_type support is incomplete across the function family #28304

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

74668fc

Other Environment Information

- MatrixOne was built from the commit above and started locally with etc/launch/launch.toml.
- MySQL comparison version: 8.0.45.
- Every query was repeated three times with the same result.

Actual Behavior

MatrixOne implements only part of MySQL's REGEXP match_type API:

  1. REGEXP_INSTR has no six-argument overload, REGEXP_SUBSTR has no
    five-argument overload, and REGEXP_REPLACE has no six-argument overload.
    Valid c and i match modes are therefore rejected as invalid function
    signatures.
  2. REGEXP_LIKE accepts c, i, m, and n, including MySQL's rightmost
    c/i precedence, but rejects the valid MySQL u match mode as invalid
    input. A row-dependent match_type column containing u aborts the complete
    query.

Representative errors are:

invalid argument function regexp_instr, bad value [VARCHAR VARCHAR BIGINT BIGINT BIGINT VARCHAR]
invalid argument function regexp_substr, bad value [VARCHAR VARCHAR BIGINT BIGINT VARCHAR]
invalid argument function regexp_replace, bad value [VARCHAR VARCHAR VARCHAR BIGINT BIGINT VARCHAR]
invalid input: regexp_like got invalid match_type input!

Expected Behavior

MatrixOne should accept the MySQL 8.0 match_type signatures and flags. For
the examples below, MySQL 8.0.45 returns:

REGEXP_INSTR(..., 'i')    1
REGEXP_INSTR(..., 'c')    5
REGEXP_SUBSTR(..., 'i')   Abc
REGEXP_SUBSTR(..., 'c')   abc
REGEXP_REPLACE(..., 'i')  X X
REGEXP_REPLACE(..., 'c')  Abc X
REGEXP_LIKE(..., 'u')     1

Steps to Reproduce

SELECT REGEXP_INSTR('Abc abc','abc',1,1,0,'i');
SELECT REGEXP_INSTR('Abc abc','abc',1,1,0,'c');

SELECT REGEXP_SUBSTR('Abc abc','abc',1,1,'i');
SELECT REGEXP_SUBSTR('Abc abc','abc',1,1,'c');

SELECT REGEXP_REPLACE('Abc abc','abc','X',1,0,'i');
SELECT REGEXP_REPLACE('Abc abc','abc','X',1,0,'c');

SELECT REGEXP_LIKE('abc','abc','u');

CREATE DATABASE codex_regexp_match_type_0907;
USE codex_regexp_match_type_0907;
CREATE TABLE r(
  id INT PRIMARY KEY,
  s VARCHAR(40),
  p VARCHAR(20),
  mt VARCHAR(8)
);
INSERT INTO r VALUES
  (1,'Abc abc','abc','i'),
  (2,'Abc abc','abc','c'),
  (3,'abc','abc','u');

SELECT id, REGEXP_LIKE(s,p,mt) AS matched
FROM r
ORDER BY id;

-- Controls already supported by MatrixOne.
SELECT REGEXP_LIKE('Abc','abc','ic');
SELECT REGEXP_LIKE('Abc','abc','ci');
SELECT REGEXP_LIKE('a\nb','a.b','n');
SELECT REGEXP_LIKE('a\nb','^b','m');

Additional information

The available overloads are registered in
pkg/sql/plan/function/list_builtIn.go. getPureMatchType in
pkg/sql/plan/function/func_builtin_regexp.go recognizes only c, i, m,
and n.

This is distinct from #27217, which covers text/binary source provenance and
prepared-parameter execution rather than the match_type function signatures
and u flag.

Activity

  1. added this to the MO-202609 milestone on Sep 7, 2026
  2. added
    kind/bug
    on Sep 7, 2026
  3. added theissue type on Sep 7, 2026
  4. self-assigned this
    on Sep 7, 2026
  5. XuPeng-SH commented on Sep 14, 2026

    @XuPeng-SH
    Contributor

    已由已合并的 PR #28794 完成:该 PR 包含原关闭 PR #28787 的 match_type overload 实现,并覆盖 REGEXP_INSTR/REGEXP_SUBSTR/REGEXP_REPLACE。关闭为 completed。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions