shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

delete from user where id=“xx” parse error in shading-jdbc 4.0.0-RC1

Open wenweibin opened this issue 7 years ago • 1 comments

When I upgrade sharding-jdbc version to 4.0.0-RC1, the SQL: delete from user where id=“xx” cannot execute correctly, but it is ok in sharding-jdbc 3.0.0. The log is:

line 1:12 no viable alternative at in input 'fromuser' Actual SQL : ds_0 ::: delete from user where id=’xx‘ .

The SQL should be written to delete from user_5 where id=“xx” .

I debug this problem and found that AntlrSQLParser can't parse table-names accurately when parsing. I try to delete USER kerword definition in Keyword.g4 and rebuild , then the SQL can execute correctly.

USER : U S E R ;

So I think there may be some mistakes in the antlr .g4 files when SQL table name is 'user'.

wenweibin avatar May 14 '19 03:05 wenweibin

The problem is not caused by id=“xx” parse error The problem is table name is user by this keyword not add to unreserved word list.

terrymanu avatar May 14 '19 03:05 terrymanu