Skip to content

Support Parenthesis-less BINARY Operator Syntax #2633

@LyzSg

Description

@LyzSg

Describe the bug
node-sql-parser currently fails to parse the parenthesis-less form of the MySQL BINARY operator. In MySQL, BINARY can be used both as an operator (without parentheses) and as a function (with parentheses), but the parser only supports the function form.

Database Engine
MySQL

To Reproduce

-- Example 1: In SELECT clause
SELECT BINARY username, COUNT(*)
FROM users;

-- Example 2: In GROUP BY clause
SELECT username, COUNT(*)
FROM users
GROUP BY BINARY username;

-- Example 3: In ORDER BY clause
SELECT username
FROM users
ORDER BY BINARY username;

-- Example 4: In WHERE condition
SELECT *
FROM users
WHERE username = BINARY 'John';

Expected behavior
The parser should correctly recognize and handle the parenthesis-less form of the BINARY operator, just as it handles the parenthesized form.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions