Debezium系列之:修改源码支持drop foreign key if exists fk
一、drop已经存在的外键报错
- io.debezium.text.ParsingException: DDL statement couldn’t be parsed.
- no viable alternative at input ‘ALTER TABLE mytable DROP FOREIGN KEY IF’ at io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:43)
at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
二、修改源码MySqlParser.g4
debezium-ddl-parser/src/main/antlr4/io/debezium/ddl/parser/mysql/generated/MySqlParser.g4
| DROP FOREIGN KEY uid ifExists? #alterByDropForeignKey // ifE
在使用Debezium时遇到DDL语句解析错误,尤其是在尝试删除已存在的外键时。本文详细介绍了如何通过修改`MySqlParser.g4`源码和更新`ddl_alter.sql`测试资源文件来解决这个问题,确保数据库操作的顺利进行。
订阅专栏 解锁全文
2385

被折叠的 条评论
为什么被折叠?



