Repository navigation
Description
MatrixOne version
Latest main at f72ca9efbeb3a7c673701e4a135cc6670c33cfde (VERSION() reports 8.0.30-MatrixOne-v1.3.0).
MySQL control: 8.3.0.
What is different
MatrixOne's parameterless UUID() generates UUID version 7 values, while MySQL's parameterless UUID() generates UUID version 1 values.
This affects more than the textual UUID value. MySQL documents the two-argument UUID_TO_BIN(uuid, 1) optimization in terms of the version-1 layout produced by UUID(), so applications that use the MySQL UUID() + UUID_TO_BIN(..., 1) pattern receive a different UUID layout in MatrixOne.
Reproduction
CREATE DATABASE uuid_compat;
USE uuid_compat;
CREATE TABLE t(seq INT PRIMARY KEY, u VARCHAR(36) NOT NULL);
INSERT INTO t VALUES
(1, UUID()), (2, UUID()), (3, UUID()), (4, UUID()),
(5, UUID()), (6, UUID()), (7, UUID()), (8, UUID());
SELECT SUBSTRING(u, 15, 1) AS version_nibble, COUNT(*) AS n
FROM t
GROUP BY SUBSTRING(u, 15, 1)
ORDER BY version_nibble;MatrixOne returns:
version_nibble | n
7 | 8
MySQL 8.3 returns:
version_nibble | n
1 | 8
The comparison was repeated three times with 32 generated values per engine per run. MatrixOne produced 96/96 v7 values and MySQL produced 96/96 v1 values.
Controls
MatrixOne's version-specific functions behave consistently, which isolates the difference to the parameterless UUID() mapping:
SELECT
UUID_EXTRACT_VERSION(UUID()),
UUID_EXTRACT_VERSION(UUID_V1()),
UUID_EXTRACT_VERSION(UUID_V7());MatrixOne returns 7, 1, 7 in all three runs. IS_UUID(), UUID_TO_BIN(), and the matching BIN_TO_UUID() round trip also succeed for all generated values. The same UUID()/UUID_V1()/UUID_V7() version result is preserved through SQL PREPARE/EXECUTE.
Why this is a compatibility issue
- MySQL 8.4 reference states that
UUID()returns UUID version 1, and thatUUID_TO_BIN(..., 1)time-part swapping assumes version-1 values such as those generated byUUID(). - MatrixOne's current UUID documentation declares
mysql_compat: full, lists no MySQL differences, and also states thatUUID()conforms to version 1. - The implementation intentionally routes
UUID()to v7:builtInUUIDcallsuuid.NewV7, and the function registry describesuuid_v7as an alias of plainuuid()(source).
Expected behavior
For MySQL compatibility, parameterless UUID() should retain MySQL's version-1 semantics, while UUID_V7() remains the explicit version-7 generator. If the v7 mapping is an intentional incompatible MatrixOne extension, it should be represented as an explicit compatibility difference rather than documented as full MySQL compatibility.
Activity
fix(sql): preserve UUID NULL and mixed character semantics (#29800)
XuPeng-SH commentedon Oct 9, 2026
PR #29800 已于 2026-10-09 合并,merge commit:
8f48d6fac04bf612be65ed1b44477ef9b32cb88f。该 PR 澄清并记录了 MatrixOne 的既定差异:
UUID()/UUID_V7()保持 native UUIDv7,显式UUID_V1()可生成 v1;需要字符表达式时可显式 cast。PR 没有改变无参UUID()的版本,因此 issue 所报告的 MySQL UUIDv1 默认行为差异仍存在,保持开放。XuPeng-SH commentedon Oct 9, 2026
PR #29800 已于 2026-10-09 合并,merge commit:
8f48d6fac04bf612be65ed1b44477ef9b32cb88f。该 PR 澄清并记录了 MatrixOne 的既定差异:
UUID()/UUID_V7()保持 native UUIDv7,显式UUID_V1()可生成 v1;需要字符表达式时可显式 cast。PR 没有改变无参UUID()的版本,因此 issue 所报告的 MySQL UUIDv1 默认行为差异仍存在,保持开放。XuPeng-SH commentedon Oct 9, 2026
PR #29800 合并后,MatrixOne 继续将 UUID() 定义为 native UUIDv7,并提供 UUID_V1() 显式生成 v1。这是已选择的产品契约;本 issue 提出的 MySQL UUID() 默认 v1 行为不计划改变,因此按 not planned 关闭。文档仍需同步修正,跟踪于 #29803(目标仓库 matrixorigin/matrixone-doc),不代表文档工作已完成。