Skip to content
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

Throw error when use COLLATE in LEFT JOIN #2263

Closed
LyzSg opened this issue Dec 18, 2024 · 0 comments · Fixed by #2265
Closed

Throw error when use COLLATE in LEFT JOIN #2263

LyzSg opened this issue Dec 18, 2024 · 0 comments · Fixed by #2265
Assignees
Labels
bug Something isn't working
Milestone

Comments

@LyzSg
Copy link

LyzSg commented Dec 18, 2024

Describe the bug
When I parse the following SQL witch use COLLATE utf8mb4_general_ci , it will throw an error:

[SyntaxError]: Expected "#", "--", "/*", ";", "FOR", "GO", "INTERSECT", "INTO", "LIMIT", "LOCK", "MINUS", "ORDER", "UNION", "WINDOW", [ \t\n\r], [A-Za-z0-9_$\x80-�], or end of input but "." found.

Database Engine
MySQL

To Reproduce
-the SQL that be parsed

const { Parser } = require('node-sql-parser');
const parser = new Parser();
const sql = `
SELECT users.id FROM users
LEFT JOIN orders ON users.id COLLATE utf8mb4_general_ci = orders.user_id;
`;
const ast = parser.astify(sql);

-the node-sql-parser version
5.3.5
-the node version

Expected behavior
This is a valid SQL statement and should be parsed correctly.

@taozhi8833998 taozhi8833998 added the bug Something isn't working label Dec 21, 2024
@taozhi8833998 taozhi8833998 added this to the 5.3.6 milestone Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants