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]: INET6_NTOA formats IPv4-compatible IPv6 tails as hexadecimal #28389
Latest main at f72ca9efbeb3a7c673701e4a135cc6670c33cfde. MySQL control: 8.3.0.
What is different
INET6_NTOA() formats IPv4-compatible IPv6 addresses (::IPv4) using the final 32 bits as two hexadecimal hextets. MySQL uses dotted-decimal IPv4 notation for this address class.
This is distinct from #28216: the IPv4-compatible input remains a correct 16-byte value and is classified correctly; only INET6_NTOA text formatting differs. #28216 covers IPv4-mapped (::ffff:IPv4) values that are collapsed to four bytes and misclassified.
The constant, table-column, round-trip, and SQL PREPARE/EXECUTE paths were reproduced identically in three runs per engine.
Controls
HEX(INET6_ATON('::192.0.2.1')) is 000000000000000000000000C0000201 in both engines.
IS_IPV6('::192.0.2.1') and IS_IPV4_COMPAT(INET6_ATON('::192.0.2.1')) both return 1 in both engines.
Ordinary IPv6 addresses, ::, ::1, and IPv6 addresses with a non-compatible embedded IPv4 tail (for example 2001:db8::192.0.2.1) use matching canonical hexadecimal output.
Root cause
For 16-byte input, MatrixOne sends non-mapped values directly through Go's net.IP.String() (Inet6Ntoa). That formatter emits ::c000:201; it does not implement MySQL's dotted-decimal rendering for IPv4-compatible IPv6 values.
Expected behavior
INET6_NTOA() should render IPv4-compatible IPv6 addresses as ::a.b.c.d, matching MySQL, while preserving the existing canonical output for ordinary IPv6 and 4-byte IPv4 inputs.
Activity
XuPeng-SH commentedon Sep 8, 2026
已完成修复并提交 PR #28447:#28447。
Root cause 已确认:16 字节输入的非 mapped 地址原先统一交给 Go
net.IP.String(),它只输出十六进制压缩形式,不实现 MySQL 对 IPv4-compatible 地址的点分十进制尾部格式化。修复严格对齐 MySQL 的边界规则:仅当前 6 个 IPv6 hextet 为 0 且第 7 个 hextet 非 0 时输出
::a.b.c.d。因此:::192.0.2.1->::192.0.2.1::255.255.255.255->::255.255.255.255::1、::100保持::1、::100验证证据:
origin/main基线真实服务仍复现::7f00:1、::c000:201、::ffff:ffff;修复服务得到 MySQL 兼容结果。sql/item_inetfunc.cc的ipv6_to_str()对照确认上述精确边界。pkg/sql/plan/function与pkg/sql/plan测试通过。molint无发现,针对模块的golangci-lint为 0 issues。该修复仅影响
INET6_NTOA文本格式化,不涉及存储、网络、查询计划或INET6_ATON二进制编码。fix(function): format IPv4-compatible IPv6 addresses (#28447)
Ariznawlll commentedon Sep 9, 2026
测试版本
maina9d3b8b857c44f1249e682c91d4d62a914eb7d20原问题验证
验证
INET6_NTOA对 IPv4-compatible IPv6 地址不再错误压缩,并保持其他地址格式不回归。Happy Path 覆盖
::127.0.0.1、::192.0.2.1均返回点分 IPv4-compatible 格式;Unhappy Path 覆盖
本 issue 的异常分支是格式错误压缩而非 SQL 参数拒绝;已以普通 IPv6/loopback/IPv4 作为非 compatible 控制组,确认未被错误套用 compatible 格式。
白盒验证
不适用:通过函数输出覆盖各地址族分支。
回归测试
suites/14_issue_regression/t/issue_28389_28387_network_return_types.test。--record --repeat 3和非 record--repeat 3均通过;PR 共 21/21 用例、321/321 条语句成功。测试证据
compatible 与非 compatible 控制组均重复 3 次。
测试结论
测试通过。
fix(function): format IPv4-compatible IPv6 addresses (matrixorigin#28447
fix(function): format IPv4-compatible IPv6 addresses (matrixorigin#28447
fix(function): format IPv4-compatible IPv6 addresses (matrixorigin#28447