tidb icon indicating copy to clipboard operation
tidb copied to clipboard

Parser syntax error for comment with DEFAULT (_utf8mb3'')

Open zgcbj opened this issue 3 weeks ago • 2 comments

Enhancement

CREATE TABLE `tb` (
  `id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `created_by` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `date_created` datetime(6) DEFAULT NULL,
  `date_updated` datetime(6) NOT NULL,
  `comment` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT (_utf8mb3''),
  `updated_by` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC

This SQL cannot be parsed by the parser.

zgcbj avatar Dec 02 '25 12:12 zgcbj

Note that change to DEFAULT (_utf8mb4'') still can't parse

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 6 column 97 near "_utf8mb4''),
  `updated_by` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC" 

lance6716 avatar Dec 03 '25 09:12 lance6716

Maybe https://github.com/pingcap/tidb/pull/59023 can solve this problem.

zgcbj avatar Dec 11 '25 03:12 zgcbj