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]: SHOW CREATE TABLE drops backslashes in column and table comments, so replaying it changes the comment #31068
SHOW CREATE TABLE prints column and table comments without escaping backslashes, so replaying its output stores different comments.
Column comment C:\dir\new is printed as COMMENT 'C:\dir\new'. Replaying gives C:dir + newline + ew (\d → d, \n → LF).
Table comment x\ty is printed as COMMENT='x\ty'. Replaying gives x + TAB + y.
Any schema copy that goes through SHOW CREATE TABLE (mo-dump, migration tools, copying DDL between accounts) silently changes these comments. Index comments are already escaped correctly (#27079). MySQL 8.0 prints COMMENT 'C:\\dir\\new' and COMMENT='x\\ty'.
Reproduction (main 80ea60a, single node, default sql_mode)
createdatabasecbs; use cbs;
createtablebs(a int comment 'C:\\dir\\new') comment 'x\\ty';
show create table bs;
-- `a` int DEFAULT NULL COMMENT 'C:\dir\new'-- ) COMMENT='x\ty'select hex(column_comment) frominformation_schema.columnswhere table_name='bs'and column_name='a';
-- 433A5C6469725C6E6577 (C:\dir\new, stored correctly)-- replay the SHOW CREATE TABLE outputcreatetablebs2(a int comment 'C:\dir\new') comment 'x\ty';
select hex(column_comment) frominformation_schema.columnswhere table_name='bs2'and column_name='a';
-- 433A6469720A6577 (C:dir<LF>ew)select hex(table_comment) frominformation_schema.tableswhere table_name in ('bs','bs2');
-- 785C7479 (x\ty) vs 780979 (x<TAB>y)
Expected
SHOW CREATE TABLE prints COMMENT 'C:\\dir\\new' and COMMENT='x\\ty' (unchanged under NO_BACKSLASH_ESCAPES), and the replayed table has the same comments.
Cause
The parser stores column and table comments with single quotes already doubled (util.DealCommentString) but backslashes raw. constructCreateTableSQL (pkg/sql/plan/build_show_util.go) writes col.Comment and the table comment property between quotes verbatim, so the quotes survive the round trip and the backslashes do not.
Activity
fix(plan): escape backslashes in SHOW CREATE TABLE comments (matrixor…
gouhongshen commentedon Oct 25, 2026
PR #31143 is trying to fix this issue.
fix(plan): escape backslashes in SHOW CREATE TABLE comments (#31069)
test(plan): pin backslash comment replay and dump fingerprint regress…
test(plan): pin backslash comment replay and dump fingerprint regress…
gouhongshen commentedon Oct 26, 2026
PR #31143 has merged and is awaiting manual validation. The issue remains open.
Ariznawlll commentedon Oct 26, 2026
测试版本
main;commit:7b80dbdbd398d171a47875f2a6196bf195a535eb。产品修复 PR #31069 已 MERGED(b160a3895c7368f7daf0f3263ea55d26d5bc4b9d),补充回归 PR #31143 亦已 MERGED(24bebb912f62aebf8a1186ba7c757fde3eef9d67);两者均为该 main 祖先。git_version()=7b80dbdbd3,SHA-2560549f8b3fcb4303f8220a15163e8b44b9c8c834e3c1ab1b19ce7ced84da999e2。日期:2026-10-27。原问题验证
交替 CN1/CN2/CN1,新库 3 轮:建立列注释
C:\dir\new、表注释x\ty的表,读取实际SHOW CREATE TABLE产物并直接换表名重放。原表和重放表的列HEX(column_comment)均为433A5C6469725C6E6577,表HEX(table_comment)均为785C7479,3/3 完全相同;不再把反斜线解释成 LF/TAB。Happy Path 覆盖
NO_BACKSLASH_ESCAPES、普通注释与 DUMP 历史指纹;本轮没有将这些 BVT 分支冒充为独立本地复测。Unhappy Path 覆盖
433A5C6469725C6E6577;每轮测试库已清理。白盒验证
问题可经公共 SQL 直接判定,本轮未重复 Go 内部测试;PR #31143 包含 render/replay 和旧 DUMP 指纹的定向 UT。
回归测试
现有 comment BVT 与配对结果已覆盖原 SQL、模式变体和 DUMP;未向 MOTR #278 重复追加。产品修复 PR #31069 的 CI Required 通过;补充测试 PR #31143 的一次 CI Required 标红,未声称其全部 CI 运行通过。
测试证据
qa-night/verify_new_five.py3/3;上述完整 SHA、十六进制值、PR/BVT/CI 链接可供复查。测试结论
测试通过。