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

Fix for query and sub query with limits #8097

Merged
merged 2 commits into from
May 12, 2021

Conversation

systay
Copy link
Collaborator

@systay systay commented May 11, 2021

Description

An outer query with a sub query, where both have LIMIT declared, sometimes will use the wrong limit for the outer query.

Example query:

SELECT * FROM t
WHERE x > (SELECT x FROM y ORDER BY col LIMIT 1)
LIMIT 100

In this query, the outer query should return 100 rows, but will before this change instead return a single row.

Related Issue(s)

Replaces #7792

Checklist

  • Tests were added or are not required
  • Documentation was added or is not required

…ess into yxj_subquery_limit_limit

Signed-off-by: yangxuanjia <yangxuanjia@jd.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay force-pushed the yxj_subquery_limit_limit2 branch from 9fbaa5f to 2b94050 Compare May 11, 2021 16:05
@systay
Copy link
Collaborator Author

systay commented May 11, 2021

Thank you @yangxuanjia for writing the fix!

@yangxuanjia
Copy link
Contributor

@systay , my pleasure.
Wonderful test case, It's hard to me.

@harshit-gangal harshit-gangal merged commit 4fd133c into vitessio:master May 12, 2021
@harshit-gangal harshit-gangal deleted the yxj_subquery_limit_limit2 branch May 12, 2021 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants