matrixorigin / matrixorigin/matrixone
[Bug]: LIMIT accepts quoted strings and expressions that MySQL rejects
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
### Branch
main at `200bfa7e0efb`.
### Summary
MySQL requires `LIMIT` arguments to be nonnegative integer constants in ordinary SQL. MatrixOne accepts some non-MySQL forms such as quoted strings and arithmetic expressions.
### Reproduction
```sql
drop database if exists mysql_compat_module9_limit_syntax;
create database mysql_compat_module9_limit_syntax;
use mysql_compat_module9_limit_syntax;
create table t(id int);
insert into t values (1),(2),(3);
select id from t order by id limit '2';
select id from t order by id limit 1+1;
```
### MySQL result
```text
ERROR 1064 (42000): You have an error in your SQL syntax ... near ''2''
ERROR 1064 (42000): You have an error in your SQL syntax ... near '+1'
```
### MatrixOne result
```text
+------+
| id |
+------+
| 1 |
| 2 |
+------+
+------+
| id |
+------+
| 1 |
| 2 |
+------+
```
### Expected behavior
For MySQL compatibility, MatrixOne should reject quoted-string and arithmetic-expression `LIMIT` arguments in ordinary SQL.
Contributor guide
Assessment
This issue has not been assessed yet.