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]: CTAS rejects CAST literal AS DATETIME(6) #25524
dropdatabase if exists repro_ctas_datetime6;
createdatabaserepro_ctas_datetime6;
use repro_ctas_datetime6;
createtabletasselect cast('2025-05-06 07:08:09.123456'as datetime(6)) as dt_lit;
select dt_lit from t;
select table_name,column_name,column_type,is_nullable
frominformation_schema.columnswhere table_schema='repro_ctas_datetime6'order by ordinal_position;
Expected behavior
Same as MySQL: CTAS succeeds and preserves datetime(6) metadata.
MatrixOne rejects the CTAS statement with a parser error:
ERROR 1105 (HY000): You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 109 near ", 6)) as dt_lit)";
Additional information
A broader CTAS/UNION probe also failed when datetime(6) was part of the CTAS select-list type inference. When the same literal is downgraded to cast(... as datetime) or converted to text, the rest of the CTAS/window/nested-view matrix can run.
Activity
daviszhen commentedon Jul 31, 2026
fixed
Ariznawlll commentedon Aug 5, 2026
测试版本
maine31ee06042bc708ac5620a579715e07ec31c21b6原问题验证
原始 CTAS
CAST(... AS DATETIME(6))连续 3/3 成功,值精确为2025-05-06 07:08:09.123456,information_schema 元数据为DATETIME(6)且 nullable=YES。Happy Path 覆盖
Unhappy Path 覆盖
bad_fsp_ctas数量为 0。dt_ctas仍为 1 行且原值不变。白盒验证
修复 PR #26349 已包含 temporal FSP 格式化、parser round-trip 和 CTAS planner UT;本轮验证公开 SQL 物化与元数据。
回归测试
MatrixOne 已有对应 BVT:create_table_as_select.sql,覆盖 DATETIME(6) 和 UNION ALL,无需重复加入 motr。
测试证据
三轮均得到 DATETIME(6)/TIME(3)/TIMESTAMP(6) 正确元数据、两条 UNION 值、非法 FSP 目标不存在、重复目标内容未变化。
测试结论
测试通过。