Skip to content

[Bug]: MATCH() AGAINST(? ...) with a bound parameter rejected by parser — breaks Prisma fullTextSearch (v3.0.11 & 4.0-dev) #24735

Closed

Description

@dengn

Summary

A literal MATCH(col) AGAINST('x' IN BOOLEAN MODE) works, but using a bound parameter as the AGAINST argument — MATCH(col) AGAINST(? IN BOOLEAN MODE) — is rejected by the parser, even when a FULLTEXT index exists. Prisma's fullTextSearch preview always parameterizes the search term, so the entire feature is unusable on MatrixOne.

Steps to Reproduce

CREATE TABLE ft (id INT PRIMARY KEY, t VARCHAR(200), FULLTEXT INDEX ft_idx(t));
INSERT INTO ft VALUES (1,'hello world');

-- literal argument: OK
SELECT id FROM ft WHERE MATCH(t) AGAINST('hello' IN BOOLEAN MODE);

-- bound parameter argument: FAILS
PREPARE st FROM 'SELECT id FROM ft WHERE MATCH(t) AGAINST(? IN BOOLEAN MODE)';
SET @q = 'hello';
EXECUTE st USING @q;
-- ERROR 1105 (HY000): You have an error in your SQL syntax ... syntax error

Prisma impact

prisma.post.findMany({ where: { title: { search: 'hello' } } }) and orderBy: { _relevance: {...} } both fail at runtime (the client binds the term as a parameter):

MysqlError { code: 1064, message: "SQL parser error: ... syntax error at ... near \"? IN BOOLEAN MODE))\"" }

Confirmed on prod v3.0.11 and 4.0-dev nightly-0bfda604, with a real FULLTEXT index present. Related: prepared-statement compatibility #24186.

Expected Behavior

MySQL accepts a placeholder/parameter as the AGAINST search string in a prepared statement.


Found during deep Prisma ORM (v5.22) compatibility testing; reproduced on prod 8.0.30-MatrixOne-v3.0.11 and nightly-0bfda604.

Activity

  1. added
    kind/bug
    on May 31, 2026
  2. added
    severity/s1
    on Jun 2, 2026
  3. added theissue type on Jun 2, 2026
  4. added this to the MO-202606 milestone on Jun 2, 2026
  5. modified the milestones: MO-202606, MO-202607 on Jun 30, 2026
  6. VioletQwQ-0 commented on Jul 20, 2026

    @VioletQwQ-0
    Collaborator

    Fixed by merged PR #24796: #24796. The prepared MATCH ... AGAINST(?) path, runtime NULL/empty validation, and prepared-statement reuse coverage are included in the merged change.

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

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s1

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions