matrixorigin / matrixorigin/matrixone
[Bug]: LIMIT in IN subquery is accepted instead of MySQL unsupported error
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
## Description
In MySQL 8.0, `LIMIT` inside an `IN` / `ALL` / `ANY` / `SOME` subquery is rejected with error 1235. MatrixOne accepts the same query and returns rows, which differs from MySQL's parser/semantic restriction.
Reference:
- MySQL subquery restrictions: https://dev.mysql.com/doc/refman/5.7/en/subquery-restrictions.html
## Reproduce
Verified on latest `origin/main` at `51656deb6`.
```sql
drop database if exists mysql_compat_model10_min;
create database mysql_compat_model10_min;
use mysql_compat_model10_min;
create table t1 (id int primary key, grp int);
create table t2 (id int primary key, t1_id int, val int);
insert into t1 values (1,10),(2,10),(3,20);
insert into t2 values (101,1,5),(102,1,7),(103,2,9);
select id from t1
where id in (select t1_id from t2 order by val desc limit 1)
order by id;
```
## MySQL 8.0.45 Result
```text
ERROR 1235 (42000): This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
```
## MatrixOne Result
```text
id
2
```
## Expected
MatrixOne should reject this syntax with a MySQL-compatible unsupported-subquery error, or otherwise document this as an intentional incompatibility.
Contributor guide
Assessment
This issue has not been assessed yet.