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

SELECT '2023-03-21 12:00:00' + INTERVAL (1+2)*3 DAY reports "Incorrect parameter count" error #42416

Open
sleepymole opened this issue Mar 21, 2023 · 1 comment

Comments

@sleepymole
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

SELECT '2023-03-21 12:00:00' + INTERVAL (1+2)*3 DAY;

2. What did you expect to see? (Required)

mysql> SELECT '2023-03-21 12:00:00' + INTERVAL (1+2)*3 DAY;
+----------------------------------------------+
| '2023-03-21 12:00:00' + INTERVAL (1+2)*3 DAY |
+----------------------------------------------+
| 2023-03-30 12:00:00                          |
+----------------------------------------------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> SELECT '2023-03-21 12:00:00' + INTERVAL (1+2)*3 DAY;
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'interval'

This query is ok on MySQL 5.7.

mysql> SELECT version();
+------------+
| version()  |
+------------+
| 5.7.41-log |
+------------+
1 row in set (0.00 sec)

mysql> SELECT '2023-03-21 12:00:00' + INTERVAL (1+2)*3 DAY;
+----------------------------------------------+
| '2023-03-21 12:00:00' + INTERVAL (1+2)*3 DAY |
+----------------------------------------------+
| 2023-03-30 12:00:00                          |
+----------------------------------------------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

+--------------------+
| version()          |
+--------------------+
| 5.7.25-TiDB-v6.6.0 |
+--------------------+
@sleepymole sleepymole added the type/bug The issue is confirmed as a bug. label Mar 21, 2023
@tiancaiamao tiancaiamao added the sig/execution SIG execution label Mar 23, 2023
@windtalker
Copy link
Contributor

windtalker commented Mar 24, 2023

I think it is a parser problem, in
SELECT '2023-03-21 12:00:00' + INTERVAL (1+2)*3 DAY;
The parser actually interpret INTERVAL(1+2) as a function, so it throws error.

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

4 participants