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

[bug] query with interval parse error #472

Closed
zhyass opened this issue Sep 2, 2019 · 0 comments
Closed

[bug] query with interval parse error #472

zhyass opened this issue Sep 2, 2019 · 0 comments
Assignees
Milestone

Comments

@zhyass
Copy link
Contributor

zhyass commented Sep 2, 2019

create table time(a int primary key,b datetime);
insert into time(a,b) values(1, now());

mysql> select b + interval 1 day from time where a=1;
+---------------------+
| b + interval 1 day  |
+---------------------+
| 2019-09-03 15:09:19 |
+---------------------+
1 row in set (8.56 sec)

mysql> select b + INTERVAL '-1 10' DAY_HOUR from time where a=1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`day_hour` from zzq.time_0035 as `time` where a = 1' at line 1
mysql> explain select b + INTERVAL '-1 10' DAY_HOUR from time where a=1;
+------------------------------------------------------------------------------------------+
| EXPLAIN          
+-------------------------------------------------------------------------------------------+
| {
        "RawQuery": " select b + INTERVAL '-1 10' DAY_HOUR from time where a=1",
        "Project": "b + interval '-1 10' `day_hour`",
        "Partitions": [
                {
                        "Query": "select b + interval '-1 10' `day_hour` from zzq.time_0035 as `time` where a = 1",
                        "Backend": "backend2",
                        "Range": "[2261-2325)"
                }
        ]
} |
+------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

error log:

 2019/09/02 18:35:46.327948 connection.go:206:    	 [ERROR] 	conn[139.198.123.188:237].execute[select b + interval '-1 10' `day_hour` from zzq.time_0035 as `time` where a = 1].len[79].error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`day_hour` from zzq.time_0035 as `time` where a = 1' at line 1 (errno 1064) (sqlstate 42000)
 2019/09/02 18:35:46.328031 txn.go:415:    	 [ERROR] 	txn.execute.on[139.198.123.188:237].query[select b + interval '-1 10' `day_hour` from zzq.time_0035 as `time` where a = 1].error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`day_hour` from zzq.time_0035 as `time` where a = 1' at line 1 (errno 1064) (sqlstate 42000)
 2019/09/02 18:35:46.328293 query.go:240:    	 [ERROR] 	proxy.select[select b + INTERVAL '-1 10' DAY_HOUR from time where a=1].from.session[1].error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`day_hour` from zzq.time_0035 as `time` where a = 1' at line 1 (errno 1064) (sqlstate 42000)
 2019/09/02 18:35:46.328325 server.go:240:    	 [ERROR] 	server.handle.query.from.session[1].error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`day_hour` from zzq.time_0035 as `time` where a = 1' at line 1 (errno 1064) (sqlstate 42000).query[select b + INTERVAL '-1 10' DAY_HOUR from time where a=1]
@zhyass zhyass added the type: bug Something isn't working label Sep 2, 2019
@zhyass zhyass added this to the v1.0.8 milestone Sep 2, 2019
@zhyass zhyass self-assigned this Sep 2, 2019
zhyass added a commit to zhyass/radon that referenced this issue Sep 2, 2019
zhyass added a commit to zhyass/radon that referenced this issue Sep 4, 2019
[summary]
select adddate('2009-09-01 19:08:01', interval '1 1' month_day) from t;
The keywords month_day parser with backquote previously, then `MySQL` report syntax error.
[testcase]
parser_test.go
[codecov]
zhyass added a commit to zhyass/radon that referenced this issue Sep 4, 2019
[summary]
select adddate('2009-09-01 19:08:01', interval '1 1' month_day) from t;
The keywords month_day parser with backquote previously, then `MySQL` report syntax error.
[testcase]
parser_test.go
[codecov]
86.4%
zhyass added a commit to zhyass/radon that referenced this issue Sep 4, 2019
[summary]
select adddate('2009-09-01 19:08:01', interval '1 1' month_day) from t;
The keywords month_day parser with backquote previously, then `MySQL` report syntax error.
[test case]
parser_test.go
[patch codecov]
86.4%
@zhyass zhyass removed the type: bug Something isn't working label Sep 4, 2019
@zhyass zhyass removed this from the v1.0.8 milestone Sep 4, 2019
@zhyass zhyass closed this as completed Sep 4, 2019
@zhyass zhyass reopened this Sep 4, 2019
zhyass added a commit to zhyass/radon that referenced this issue Sep 5, 2019
[summary]
select adddate('2009-09-01 19:08:01', interval '1 1' month_day) from t;
The keywords month_day parser with backquote previously, then `MySQL` report syntax error.
[test case]
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/parse_test.go
[patch codecov]
86.4%
BohuTANG pushed a commit that referenced this issue Sep 6, 2019
[summary]
select adddate('2009-09-01 19:08:01', interval '1 1' month_day) from t;
The keywords month_day parser with backquote previously, then `MySQL` report syntax error.
[test case]
src/vendor/github.com/xelabs/go-mysqlstack/sqlparser/parse_test.go
[patch codecov]
86.4%
@zhyass zhyass closed this as completed Sep 6, 2019
@zhyass zhyass added this to the v1.0.8 milestone Sep 6, 2019
@zhyass zhyass added the type: bug Something isn't working label Sep 6, 2019
@andyli029 andyli029 added type: feature type: bug Something isn't working and removed type: bug Something isn't working type: feature labels Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants