-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Vitess does not like parenthesis around selects #6305
Comments
sougou
added a commit
to planetscale/vitess
that referenced
this issue
Jun 17, 2020
Start of fix for vitessio#6305 Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
PR: #6342 fixes this issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#5737 ## Overview of the Issue
We are evaluating using Vitess with our existing application. We simply put Vitess in front of our mysql 5.6 db and directed the app to Vitess with no sharding. We have seen a couple of queries fail with syntax errors that we were not expecting. If they are documented, we could not find them. The first is when there are extra parenthesis around the select. Here is vtexplain with a simplified example:
if I remove the parenthesis, vitess is happy. Note that mysql is happy with either. You may argue that the parens are not needed in this case, but we were wondering why vitess fails.
Reproduction Steps
Steps to reproduce this issue, example:
Deploy the following
vschema
which is basically empty:{
"mainkeyspace": {
"sharded": false,
"vindexes": {
"hash": {
"type": "hash"
},
"md5": {
"type": "unicode_loose_md5",
"params": {},
"owner": ""
},
"users_name_idx": {
"type": "lookup_hash",
"params": {
"from": "name",
"table": "users_name_idx",
"to": "user_id"
},
"owner": "users"
}
},
"tables": {
}
}
}
```
Deploy the following
schema
:CREATE TABLE
notification
(name
varchar(255) DEFAULT NULL,sys_created_on
datetime DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;
```
Run vtexplain
vtexplain -sql-file stmt.sql -schema-file schema.sql -vschema-file vschema.json
View error
ERROR: vtexplain execute error in '(SELECT notification.
name
, notification.sys_created_on
ASorder
FROM notification WHERE notification.sys_created_on
>= '2020-04-24') ORDER BYorder
': syntax error at position 147 near 'ORDER'Show non-error case
If we remove the extra parens, it works:
vtexplain -sql-file stmt.sql -schema-file schema.sql -vschema-file vschema.json
SELECT notification.
name
, notification.sys_created_on
ASorder
FROM notification WHERE notification.sys_created_on
>= '2020-04-24' ORDER BYorder
1 mainkeyspace/-: select notification.name, notification.sys_created_on as
order
from notification where notification.sys_created_on >= '2020-04-24' order byorder
asc limit 10001Operating system and Environment details
We are testing this on a Mac OSX Catalina (10.15.5) as that is our development environment.
The text was updated successfully, but these errors were encountered: