matrixorigin / matrixorigin/matrixone
[Bug]: GREATEST/LEAST reject mixed string-date arguments unlike MySQL
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
## Bug Report
### MatrixOne Version
Latest `origin/main` verified locally at `200bfa7e0efb`.
### Reproduce Steps
```sql
set session sql_mode = '';
select greatest(cast('2024-01-02' as date), cast('2023-12-31' as date)) as greatest_date,
least(cast('2024-01-02' as date), cast('2023-12-31' as date)) as least_date;
select greatest('2024-01-02', cast('2024-01-10' as date)) as greatest_str_date,
least('2024-01-02', cast('2024-01-10' as date)) as least_str_date;
```
### Expected Behavior
MySQL supports both same-type temporal arguments and mixed string/date arguments:
```text
greatest_date least_date
2024-01-02 2023-12-31
greatest_str_date least_str_date
2024-01-10 2024-01-02
```
### Actual Behavior
MatrixOne supports the same-type temporal row but rejects the mixed string/date row:
```text
greatest_date least_date
2024-01-02 2023-12-31
ERROR 20203 (HY000): invalid argument function greatest, bad value [VARCHAR DATE]
```
### Notes
Found during MySQL compatibility Module 7 exploration. Existing #25215 covers mixed string-number arguments for `GREATEST/LEAST`; this issue tracks the separate mixed string/date path.
Contributor guide
Assessment
This issue has not been assessed yet.