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

Wrong LIMIT rewrite while using nested SELECT #2059

Closed
joooohnli opened this issue Mar 19, 2019 · 1 comment
Closed

Wrong LIMIT rewrite while using nested SELECT #2059

joooohnli opened this issue Mar 19, 2019 · 1 comment

Comments

@joooohnli
Copy link

joooohnli commented Mar 19, 2019

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details.
If no response more than 7 days and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

3.1.0

Which project did you use? Sharding-JDBC or Sharding-Proxy?

Sharding-JDBC

Expected behavior

Actual behavior

image

Reason analyze (If you can)

io.shardingsphere.core.parsing.parser.context.limit.Limit#rewrite
image

io.shardingsphere.core.routing.router.sharding.ParsingSQLRouter#processLimit
image

I guess it is related to the wrong sql parsing.

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Run it with PreparedStatement:

SELECT MIN(momentID) FROM (SELECT momentID FROM LatestMoment WHERE momentID < ? ORDER BY momentID DESC LIMIT ?)

Example codes for reproduce this issue (such as a github link).

@terrymanu
Copy link
Member

Do not support subquery if not on single sharding data node.
Please note, we want focus SQL more make sense for sharding databases, not for all SQL

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

No branches or pull requests

2 participants