Closed

Description
现状: PK列名大写时(如ID
), Column.IsPk()
错误地返回false. 导致kafka输出key(主键)的payload为空.
代码位置:
func GetPrimaryKey(stmt *ast.CreateTableStmt) (map[string]struct{}, bool) {
hasPk := false
pkColumnsName := map[string]struct{}{}
for _, constraint := range stmt.Constraints {
if constraint.Tp == ast.ConstraintPrimaryKey {
hasPk = true
for _, col := range constraint.Keys {
pkColumnsName[col.Column.Name.L] = struct{}{} // **HERE**
}
}
}
更新, 和上述代码没有关系. 为了方便作case-insensitive的比较, 统一使用小写.