matrixorigin / matrixorigin/matrixone
[Bug]: Stored procedure OUT parameter assignment from scalar subquery is not supported
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
### Environment
- Branch: latest `main`
- MO git version: `51656deb6`
- MySQL oracle: `8.0.45`
### Reproduce
```sql
drop database if exists mysql_compat_model15_out_min;
create database mysql_compat_model15_out_min;
use mysql_compat_model15_out_min;
create table t_routine (id int primary key, v varchar(20));
insert into t_routine values (1,'a'),(2,'b'),(3,'c');
create procedure p_out_literal(out p_cnt int) 'begin set p_cnt = 100; end';
call p_out_literal(@cnt1);
select @cnt1 as cnt1;
create procedure p_out_subquery(out p_cnt int)
'begin set p_cnt = (select count(*) from t_routine); end';
call p_out_subquery(@cnt2);
select @cnt2 as cnt2;
```
### MySQL equivalent
Using MySQL's standard routine syntax, assigning a scalar subquery to an OUT parameter works and returns the row count:
```text
cnt1
100
cnt2
3
```
### MO result
Literal OUT assignment works:
```text
cnt1
100
```
But scalar subquery assignment fails:
```text
ERROR 20102 (HY000): unsupported expression executor for typ: sub: now is not yet implemented
ERROR 20101 (HY000): internal error: the user variable cnt2 does not exist
```
### Expected
Stored procedures should support assigning a scalar subquery result to local / OUT variables, matching MySQL routine behavior.
Contributor guide
Assessment
This issue has not been assessed yet.