matrixorigin / matrixorigin/matrixone

[Bug]: PERIOD_ADD/PERIOD_DIFF invalid month handling differs from MySQL

Open
#25,307 0 comments 0 reactions 1 assignee Claimed by @jiangxinmeng1 View on GitHub
kind/bug needs-triage
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 period_add(202413, 1) as add_bad_month,
period_diff(202413, 202312) as diff_bad_month;
```

### Expected Behavior

MySQL rejects invalid period months:

```text
ERROR 1210 (HY000): Incorrect arguments to period_add
```

### Actual Behavior

MatrixOne returns `NULL` values instead of raising the MySQL-compatible error:

```text
add_bad_month diff_bad_month
NULL NULL
```

### Notes

Found during MySQL compatibility Module 5 exploration. Existing #24504 is a broad old feature request for unsupported datetime functions on 3.0-dev; on latest main `PERIOD_ADD` / `PERIOD_DIFF` exist, so this is now a behavior compatibility bug for invalid period arguments.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.