Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-4503

Drop the primary key column getting exception

    XMLWordPrintable

Details

    Description

      Create the tb2 with the `ID` as primary key, and drop the primary key, getting the following exception.

      CREATE TABLE `tb2` (
        `id` int NOT NULL AUTO_INCREMENT,
        `v1` varchar(255) DEFAULT NULL,
        `v22` int NOT NULL DEFAULT '1',
        `v2` int NULL,
        `v3` int null unique key,
        PRIMARY KEY (`ID`),
        UNIQUE KEY `uv2_idx` (`v22`),
        UNIQUE KEY (`v22`,`v2`)
      ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
      
      alter table tb2 drop column id;
      

       

      java.lang.IllegalArgumentException: The column "ID" is referenced as PRIMARY KEY, but a matching column is not defined in table "tb2"!
      
          at io.debezium.relational.TableEditorImpl.lambda$updatePrimaryKeys$0(TableEditorImpl.java:106)
          at java.base/java.util.ArrayList.removeIf(ArrayList.java:1702)
          at java.base/java.util.ArrayList.removeIf(ArrayList.java:1690)
          at io.debezium.relational.TableEditorImpl.updatePrimaryKeys(TableEditorImpl.java:102)
          at io.debezium.relational.TableEditorImpl.create(TableEditorImpl.java:266)
          at io.debezium.connector.mysql.antlr.listener.AlterTableParserListener.lambda$exitAlterTable$0(AlterTableParserListener.java:74)
          at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.runIfNotNull(MySqlAntlrDdlParser.java:358)
          at io.debezium.connector.mysql.antlr.listener.AlterTableParserListener.exitAlterTable(AlterTableParserListener.java:72)
          at io.debezium.ddl.parser.mysql.generated.MySqlParser$AlterTableContext.exitRule(MySqlParser.java:13899)
          at io.debezium.antlr.ProxyParseTreeListenerUtil.delegateExitRule(ProxyParseTreeListenerUtil.java:64)
          at io.debezium.connector.mysql.antlr.listener.MySqlAntlrDdlParserListener.exitEveryRule(MySqlAntlrDdlParserListener.java:106)
          at org.antlr.v4.runtime.tree.ParseTreeWalker.exitRule(ParseTreeWalker.java:48)
          at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:30)
          at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)
          at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)
          at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)
          at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:28)
          at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:87)
          at io.debezium.connector.mysql.MySqlAntlrDdlParserTest.shouldProcessMultipleSignedUnsignedForTable(MySqlAntlrDdlParserTest.java:98)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.base/java.lang.reflect.Method.invoke(Method.java:566)
          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
          at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
          at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
          at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
          at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
          at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
          at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
          at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
          at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
          at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
          at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ywyuewei Harvey Yue
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: