Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canal can't parse value of ddl #754

Open
BLAZZ opened this issue Dec 13, 2022 · 3 comments
Open

canal can't parse value of ddl #754

BLAZZ opened this issue Dec 13, 2022 · 3 comments

Comments

@BLAZZ
Copy link
Contributor

BLAZZ commented Dec 13, 2022

canal.valueExpr can't work

ALTER TABLE `sometable` MODIFY COLUMN `some_col` varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'comments' AFTER `other_col`

become

ALTER TABLE `sometable` MODIFY COLUMN `some_col` VARCHAR(1024) CHARACTER SET UTF8 COLLATE utf8_bin NOT NULL DEFAULT  COMMENT  AFTER `other_col`

after (*ast.AlterTableStmt).Restore(ctx *format.RestoreCtx), default value and comment value lost

change "github.com/pingcap/parser" test_driver to public or copy the implements to canal?

@lance6716
Copy link
Collaborator

I didn't find where go-mysql uses (*ast.AlterTableStmt).Restore(ctx *format.RestoreCtx), can you explain it?

@BLAZZ
Copy link
Contributor Author

BLAZZ commented Dec 19, 2022

AlterTableStmt is parsed from replication.QueryEvent, and send to eventHandler.OnDDL, use (*ast.AlterTableStmt).Restore(ctx *format.RestoreCtx) is easy to sync ddl to the target database when using canal

@lance6716
Copy link
Collaborator

lance6716 commented Dec 19, 2022

So where does go-mysql use (*ast.AlterTableStmt).Restore(ctx *format.RestoreCtx)? If it's used in your application, you can change your code rather than go-mysql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants