alibaba / druid

阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
https://github.com/alibaba/druid/wiki
Apache License 2.0
27.98k stars 8.59k forks source link

[BUG] 如果配置了selectLimit,offset会被强行修改为0 #6211

Open yinhaox opened 3 weeks ago

yinhaox commented 3 weeks ago

Database Type

MySQL

Database Version

MySQL 8

Druid Version

1.2.23

JDK Version

JDK 17

Error SQL

SELECT * FROM any_table LIMIT 123, 456;

Testcase Code

No response

Stacktrace Info

No response

Error Info

如果设置了selectLimit,并且我的sql设置了offset和limit,这里会直接把我的offset改成0: com.alibaba.druid.wall.WallVisitor#visit(com.alibaba.druid.sql.ast.statement.SQLSelectStatement) image

原因是 #3263 将com.alibaba.druid.sql.PagerUtils#limitMySqlQueryBlock里offset > 0的条件改为了offset >= 0,导致我传入的offset被修改为0 image

yinhaox commented 2 weeks ago

1.2.20版本没有问题