Closed zackshen closed 2 months ago
Describe the bug
const { Parser } = require('node-sql-parser'); const parser = new Parser(); const ast = parser.astify('SELECT * FROM xxxxx WHERE key = "value1"'); // mysql sql grammer parsed by default
error
[SyntaxError]: Expected "#", "(", "--", ".", "/*", or [ \t\n\r] but "=" found.
if i changed key to ky , key1 , astify successfully.
key
ky
key1
Database Engine MySQL
To Reproduce -the SQL that be parsed: SELECT * FROM xxxxx WHERE key = "value1" -the node-sql-parser: 5.3.2 -the node version: 20.3.1
Expected behavior astify successfully.
Screenshots no screenshot.
Additional context no context.
@zackshen key is a reserved keyword in MySQL, so please wrap it by ` in MySQL.
SELECT * FROM xxxxx WHERE `key` = "value1"
thanks @taozhi8833998
Describe the bug
error
if i changed
key
toky
,key1
, astify successfully.Database Engine MySQL
To Reproduce -the SQL that be parsed: SELECT * FROM xxxxx WHERE key = "value1" -the node-sql-parser: 5.3.2 -the node version: 20.3.1
Expected behavior astify successfully.
Screenshots no screenshot.
Additional context no context.