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

Fixes subquery rewrite when it is part of IN clause #8589

Merged

Conversation

GuptaManan100
Copy link
Member

Description

Currently our rewriter, incorrectly rewrites a subquery which is part of an IN clause
For example, consider the following query -

SELECT id FROM user WHERE id IN (SELECT 1 FROM DUAL)

This query is rewritten to -

SELECT id FROM user WHERE id IN 1

but this is syntactically wrong. Instead we must rewrite it to -

SELECT id FROM user WHERE id IN (1)

This PR fixes this problem

Related Issue(s)

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: GuptaManan100 <manan@planetscale.com>
@harshit-gangal harshit-gangal merged commit 2f5e02f into vitessio:main Aug 5, 2021
@harshit-gangal harshit-gangal deleted the incorrect-subquery-rewrite branch August 5, 2021 05:20
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.

3 participants