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
[Compatibility]: TIMESTAMP(expr) returns TIMESTAMP(0) instead of MySQL DATETIME #30196
For the one-argument TIMESTAMP(expr) function, MatrixOne exposes a TIMESTAMP result with scale 0. MySQL documents this form as returning the input date/datetime expression as a DATETIME value. The MatrixOne type difference also truncates fractional seconds and makes a CTAS result depend on the session time zone when it is later read.
This is distinct from #26775, which covers the return type of DATE_ADD / DATE_SUB for a TIMESTAMP input, and from #28896, which covered conditional-expression precision.
Reproduction: type and fractional value
CREATEDATABASErepro;
USE repro;
CREATETABLEcASSELECTTIMESTAMP(CAST('2024-02-29 12:34:56.123456'AS DATETIME(6))) AS v;
SELECT column_type, datetime_precision
FROMinformation_schema.columnsWHERE table_schema = DATABASE() AND table_name ='c';
SELECT CAST(v ASCHAR) FROM c;
MatrixOne: column timestamp (precision 0); value 2024-02-29 12:34:56
MySQL 8.0.46: column datetime(6); value 2024-02-29 12:34:56.123456
The same truncation occurs with a string argument. The two-argument TIMESTAMP(expr1, expr2) control returned DATETIME(6) on both engines in this comparison.
Reproduction: session-time-zone dependency after CTAS
SET time_zone ='+00:00';
CREATETABLEtz_copyASSELECTTIMESTAMP('2024-02-29 12:34:56') AS v;
SELECT v FROM tz_copy;
SET time_zone ='+08:00';
SELECT v FROM tz_copy;
MatrixOne changes the stored value from 12:34:56 to 20:34:56; MySQL continues to return 12:34:56. This follows from the MatrixOne CTAS column being TIMESTAMP, while MySQL creates DATETIME for the one-argument function.
MOTR #247 新增成对 t/issue_30195_30196_30197_prepared_temporal.test / r/*.result,当前 head 623ac129a7d011ae0d441cd4275d0100e5d8d854,定向 3/3、135/135 语句成功、0 skip;PR 未合入。完整 659 case suite 尝试启动后中断,专用库已清理;完整 suite/集成 CI 未完成。
Activity
Ariznawlll commentedon Oct 19, 2026
测试版本
main8e63625c4e9baeb1d28c1095c07732f056c04895d82e828b0a4df9ce635fe573c1e90c5cde978bf9已进入该 main。原问题验证
原始
CREATE TABLE c AS SELECT TIMESTAMP(CAST('2024-02-29 12:34:56.123456' AS DATETIME(6)))独立 3/3:information_schema.columns为datetime(6)、精度 6,实际值2024-02-29 12:34:56.123456,不再是旧timestamp(0)截断值。+00:00建表后切换+08:00读取,3/3 仍是完全相同的值。Happy Path 覆盖
TIMESTAMP('2024-02-29 12:34:56')CTAS 3/3 为datetime和2024-02-29 12:34:56,切换时区后不变。TIMESTAMP('2024-02-29','12:34:56.123456')对照 3/3 为2024-02-29 12:34:56.123456。Unhappy Path 覆盖
TIMESTAMP(NULL)、TIMESTAMP('invalid')各 3/3 返回 NULL,未出现错误值;专用库清理后不存在。本场景无跨表写入失败原子性路径。白盒验证
同 SHA 定向
TestPreparedTemporalResultContracts|TestPreparedTemporalMarkerReuse|TestTemporalCompatibilityExecutionMatrix|TestDynamicTimeResultTypedCalendarAndMask,pkg/sql/plan/... -count=3PASS;覆盖类型/精度求值。已有 MatrixOne 分布式 SQL 文件test/distributed/cases/prepare/prepared_temporal_results.sql包含时区切换与类型断言,本轮未独立运行该 BVT。回归测试
MOTR #247 新增成对
t/issue_30195_30196_30197_prepared_temporal.test/r/*.result,当前 head623ac129a7d011ae0d441cd4275d0100e5d8d854,定向 3/3、135/135 语句成功、0 skip;PR 未合入。完整 659 case suite 尝试启动后中断,专用库已清理;完整 suite/集成 CI 未完成。测试证据
total=3 success=3 failed=0 skipped=0 | stmts=135 ok=135 fail=0。测试结论
测试通过。