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

Default value set null when modify a column from nullable to not null

    Details

      Description

      There's a relational issue DBZ-771, it solved the bug when execute statement alter table change about default value,
      but, statement alter table modify also cause the same issue.

      Just extend DBZ-771's test case,
      io.debezium.connector.mysql.MysqlDefaultValueIT.columnTypeChangeResetsDefaultValue(),
      continue execute these two SQLs

      alter table DBZ_771_CUSTOMERS modify customer_type int null;
      alter table DBZ_771_CUSTOMERS modify customer_type int not null;
      

      will cause Exception:

      ......
      Caused by: org.apache.kafka.connect.errors.DataException: Invalid value: null used for required field: "null", schema type: INT32
      	at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:220)
      	at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:213)
      	at org.apache.kafka.connect.data.SchemaBuilder.defaultValue(SchemaBuilder.java:129)
      	... 19 more
      

      Caz after apply alter table DBZ_771_CUSTOMERS modify customer_type int not null; this column definition is customer_type int not null default value null;, it should reset default value just same as parsing alter table change

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pan3793 Cheng Pan
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: