You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: ONLY_FULL_GROUP_BY rejects MySQL-compatible single-value and functional-dependency queries #25327
MatrixOne rejects some ONLY_FULL_GROUP_BY queries that MySQL accepts:
A non-grouped column is constrained to a single value by WHERE.
A non-grouped column is functionally dependent on the grouped primary key.
MySQL documents both as valid behavior under ONLY_FULL_GROUP_BY.
Reproduction
dropdatabase if exists mysql_compat_module8_ofgb;
createdatabasemysql_compat_module8_ofgb;
use mysql_compat_module8_ofgb;
set session sql_mode='ONLY_FULL_GROUP_BY';
createtablet_sales(region varchar(10), product varchar(10), qty int);
insert into t_sales values
('east','phone',2),
('east','phone',null),
('west','phone',3),
(null,'phone',5);
select region, product, sum(qty) as s_qty
from t_sales
where product='phone'group by region
order by region is null, region;
createtablet_fd(id intprimary key, name varchar(20), amount int);
insert into t_fd values (1,'a',10),(2,'b',20),(3,'c',30);
select id, name, sum(amount)
from t_fd
group by id
order by id;
MySQL result
+--------+---------+-------+
| region | product | s_qty |
+--------+---------+-------+
| east | phone | 2 |
| west | phone | 3 |
| NULL | phone | 5 |
+--------+---------+-------+
+----+------+-------------+
| id | name | sum(amount) |
+----+------+-------------+
| 1 | a | 10 |
| 2 | b | 20 |
| 3 | c | 30 |
+----+------+-------------+
MatrixOne result
ERROR 1149 (HY000): SQL syntax error: column "t_sales.product" must appear in the GROUP BY clause or be used in an aggregate function
ERROR 1149 (HY000): SQL syntax error: column "t_fd.name" must appear in the GROUP BY clause or be used in an aggregate function
Expected behavior
MatrixOne should accept these queries when the non-grouped column is limited to one value or functionally dependent on the grouped primary key, matching MySQL ONLY_FULL_GROUP_BY behavior.
Linux x86_64 standalone official binary, 4 CPUs, ~16 GiB container memory limit. SELECT VERSION() = 8.0.30-MatrixOne-v4.2.5. PyMySQL 1.2.3 client. Only fresh owned test schemas were used for SQL probes; the native Airflow diagnostic is a read-only SELECT against the retained test fixture.
Actual Behavior
Native application impact: 原生调度/聚合查询失败。
ERROR 1149: SQL syntax error: column "grouped.name" must appear in the GROUP BY clause or be used in an aggregate function
Expected Behavior
Recognize functional dependence on the complete grouped primary key under ONLY_FULL_GROUP_BY, while continuing to reject ambiguous groupings.
Steps to Reproduce
Use a dedicated fresh test schema (create one without DROP DATABASE), then run:
CREATETABLEgrouped(id INTPRIMARY KEY,name VARCHAR(20),value INT);
INSERT INTO grouped VALUES(1,'owned',7);
SELECT id,name,SUM(value) FROM grouped GROUP BY id;
Activity
Ariznawlll commentedon Aug 10, 2026
测试版本
main3c7392a0f86b23712da71f31d7a9198a2c8591a9原问题验证
在
ONLY_FULL_GROUP_BY下,issue 的单值WHERE product='phone'和主键函数依赖两类查询连续执行 3 次均成功,不再报列必须出现在 GROUP BY 的错误。Happy Path 覆盖
name,三行结果与各自主键一致。Unhappy Path 覆盖
product的查询连续 3 次均正确被拒绝(错误1149),说明放宽没有误接受一般不确定分组。SELECT 1均成功;只读查询无失败写入原子性维度。白盒验证
不适用:使用公开 SQL mode 和结果语义黑盒验证。
回归测试
已加入 motr PR #89 的
suites/14_issue_regression/t/issue_26269_25973_25389_25327_25326_sql_semantics.test(commita6a50dfcf7053027dab5e9117fde7bdd7b5cdefb);拒绝对照另行连续验证 3 次。测试证据
MOTR 固定回归连续 3 轮通过;关联 5 个场景合计 15/15 成功、171 条断言成功。
测试结论
测试通过。
dengn commentedon Oct 11, 2026
Application compatibility replay on official v4.2.5
Branch Name
Official stable release
v4.2.5; current main has not been retested for this report.Commit ID
1a44f3db3056e32975fde86ca0ab69a094996a3f(SELECT git_version()returns1a44f3d).Other Environment Information
Linux x86_64 standalone official binary, 4 CPUs, ~16 GiB container memory limit.
SELECT VERSION()=8.0.30-MatrixOne-v4.2.5. PyMySQL 1.2.3 client. Only fresh owned test schemas were used for SQL probes; the native Airflow diagnostic is a read-only SELECT against the retained test fixture.Actual Behavior
Native application impact: 原生调度/聚合查询失败。
Expected Behavior
Recognize functional dependence on the complete grouped primary key under ONLY_FULL_GROUP_BY, while continuing to reject ambiguous groupings.
Steps to Reproduce
Use a dedicated fresh test schema (create one without DROP DATABASE), then run:
Additional information
MO-OBS-009. App-side workarounds do not constitute an engine fix.