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

使用'SKIP LOCKED'(MySQL8.0)关键字抛出ParserException: syntax error #4070

Closed
ulqio opened this issue Dec 4, 2020 · 1 comment
Closed
Labels
Milestone

Comments

@ulqio
Copy link

ulqio commented Dec 4, 2020

数据库及druid版本:

  • MySQL 8.0
  • druid 1.2.2

报错的SQL语句

SELECT * FROM table_name WHERE ref = ? AND flag = 0 LIMIT ? FOR UPDATE SKIP LOCKED

错误信息:

Caused by: java.sql.SQLException: sql injection violation, dbType mysql, , druid-version 1.2.2, syntax error: syntax error, error in :'SKIP LOCKED, pos 115, line 2, column 34, token IDENTIFIER LOCKED : SELECT * FROM table_name WHERE ref = ? AND flag = 0
LIMIT ? FOR UPDATE SKIP LOCKED
at com.alibaba.druid.wall.WallFilter.checkInternal(WallFilter.java:849)
at com.alibaba.druid.wall.WallFilter.connection_prepareStatement(WallFilter.java:292)
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:568)
at com.alibaba.druid.filter.FilterAdapter.connection_prepareStatement(FilterAdapter.java:930)
at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:122)
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:568)
at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:341)
at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:351)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:86)
at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:108)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy139.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
... 80 more
Caused by: com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'SKIP LOCKED, pos 115, line 2, column 34, token IDENTIFIER LOCKED
at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:558)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:602)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:124)
at com.alibaba.druid.wall.WallProvider.checkInternal(WallProvider.java:629)
at com.alibaba.druid.wall.WallProvider.check(WallProvider.java:583)
at com.alibaba.druid.wall.WallFilter.checkInternal(WallFilter.java:826)
... 105 more

@wenshao wenshao added the Bug label Dec 12, 2020
@wenshao wenshao added this to the 1.2.4 milestone Dec 12, 2020
@wenshao wenshao closed this as completed Dec 12, 2020
@wenshao
Copy link
Member

wenshao commented Dec 12, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants