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

Syntax error parsing WHERE id IN (SELECT 1 FROM dual) #8522

Closed
jcberleur opened this issue Jul 22, 2021 · 5 comments
Closed

Syntax error parsing WHERE id IN (SELECT 1 FROM dual) #8522

jcberleur opened this issue Jul 22, 2021 · 5 comments

Comments

@jcberleur
Copy link

Running the following query (generated by an orm)

SELECT * FROM tbl WHERE id IN (SELECT 1 FROM dual WHERE 1 = 0);

I get this error

ERROR 1105 (HY000): target: legacy.-.master: vttablet: rpc error: code = InvalidArgument desc = syntax error at position 36 near ':vtg1' (CallerID: user)

using the EXPLAIN or passing the query directly to mysql/mariadb works correctly

MySQL [legacy]> EXPLAIN FORMAT=VITESS SELECT * FROM tbl WHERE id IN (SELECT 1 FROM dual WHERE 1 = 0);
+----------+-----------------+----------+-------------+------------+----------------------------------------------------------------+
| operator | variant         | keyspace | destination | tabletType | query                                                          |
+----------+-----------------+----------+-------------+------------+----------------------------------------------------------------+
| Route    | SelectUnsharded | legacy   |             | UNKNOWN    | select * from tbl where id in (select 1 from dual where 1 = 0) |
+----------+-----------------+----------+-------------+------------+----------------------------------------------------------------+

version

Running vitess/lite:v10.0.2 with the kubernetes operator

Version: 10.0.2 (Git revision fc7847093 branch 'heads/v10.0.2') built on Thu May 27 09:00:55 UTC 2021 by vitess@c8edcabbb04a using go1.15.6 linux/amd64
@jcberleur jcberleur changed the title Syntax error parsing `WHERE id IN (SELECT 1 FROM dual) Syntax error parsing WHERE id IN (SELECT 1 FROM dual) Jul 23, 2021
@jcberleur
Copy link
Author

SELECT IN seems to have been added in #8155, but subquery support is still missing

ERROR 1235 (42000): gen4 does not yet support: subquery

@GuptaManan100
Copy link
Member

Which planner version are you using, V3 or Gen4 or Gen4Fallback? Also, have you turned on query normalization on the vtgate?

@jcberleur
Copy link
Author

I tried the default and Gen4

@GuptaManan100
Copy link
Member

Yes that makes sense, the problem is in the rewriter, which should be fixed by #8589. Work on supporting subqueries in Gen4 is still underway.

@GuptaManan100
Copy link
Member

Please reopen if the issue persists.

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

3 participants