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

SQL Server NULLABLE with default value column read incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • 2.5.2.Final
    • None
    • None
    • False
    • None
    • False

      In order to make your issue reports as actionable as possible, please provide the following information, depending on the issue type.

      Bug report

      For bug reports, provide this information, please:

      What Debezium connector do you use and what version?

      2.5.2.Final SQL Server debezium connection in a DebeziumEngine

      What is the connector configuration?

      connector.class = io.debezium.connector.sqlserver.SqlServerConnector
      driver.encrypt = true
      max.queue.size = 8192
      schema.include.list = dbo
      include.schema.changes = false
      provide.transaction.metadata = false
      schema.history.internal.store.only.captured.databases.ddl = true
      schema.history.internal.file.filename = /tmp/cdc-db-history6713974557523905698/dbhistory.dat
      topic.prefix = mssql-benchmark-db
      offset.storage.file.filename = /tmp/cdc-state-offset14901855936718051766/offset.dat
      decimal.handling.mode = string
      converters = mssql_converter
      errors.retry.delay.initial.ms = 299
      value.converter = org.apache.kafka.connect.json.JsonConverter
      key.converter = org.apache.kafka.connect.json.JsonConverter
      database.user = test
      database.dbname = mssql-benchmark-db
      database.names = mssql-benchmark-db
      offset.storage = org.apache.kafka.connect.storage.FileOffsetBackingStore
      max.queue.size.in.bytes = 268435456
      mssql_converter.type = io.airbyte.integrations.source.mssql.MssqlDebeziumConverter
      errors.retry.delay.max.ms = 300
      offset.flush.timeout.ms = 5000
      heartbeat.interval.ms = 10000
      snapshot.isolation.mode = read_committed
      column.include.list = \Qdbo.check_def\E\.(\Qcolumn_1\E|\Qwith_default\E|\Qwithout_default\E)
      database.port = 1433
      offset.flush.interval.ms = 1000
      key.converter.schemas.enable = false
      schema.history.internal = io.debezium.storage.file.history.FileSchemaHistory
      driver.trustServerCertificate = true
      errors.max.retries = 0
      database.hostname = mssql-benchmark-server.database.windows.net
      database.password = ********
      value.converter.schemas.enable = false
      name = mssql-benchmark-db
      task.id = 0
      max.batch.size = 2048
      table.include.list = \Qdbo.check_def\E
      snapshot.mode = initial

      What is the captured database version and mode of depoyment?

      (E.g. on-premises, with a specific cloud provider, etc.)

      Microsoft SQL Server:12.00.5409 (Azure)

      What behaviour do you expect?

      In the following table

      CREATE TABLE [dbo].[check_def] (
      [column_1] INT NOT NULL,
      [with_default] INT CONSTRAINT [DEFAULT_check_def_with_default] DEFAULT ((0)) NULL,
      [without_default] INT NULL,
      CONSTRAINT [PK_check_def] PRIMARY KEYCLUSTERED ([column_1] ASC) 

       
      The column with_default is nullable and has a default value 0.
      The column without_default is nullable only.
       
      When inserting the following to the table:

      INSERT INTO dbo.check_def VALUES (32,NULL,NULL) 

       
      We expect the change event in debezium to be 32, NULL, NULL.
        

      What behaviour do you see?

      The change event in debezium is actually 32, 0, NULL (0 being the default value of the with_default column).

      The ChangeEvent coming from debezium is (key:value)

      {"column_1":32}:{"before":null,"after":{"column_1":32,"with_default":0,"without_default":null},"source":{"version":"2.5.2.Final","connector":"sqlserver","name":"mssql-benchmark-db","ts_ms":1710258225127,"snapshot":"false","db":"mssql-benchmark-db","sequence":null,"schema":"dbo","table":"check_def","change_lsn":"0000e24b:00002320:0003","commit_lsn":"0000e24b:00002320:0005","event_serial_no":1},"op":"c","ts_ms":1710258244794,"transaction":null}

      Do you see the same behaviour using the latest relesead Debezium version?

      (Ideally, also verify with latest Alpha/Beta/CR version)

      <Your answer>

      Do you have the connector logs, ideally from start till finish?

      (You might be asked later to provide DEBUG/TRACE level log)

      <Your answer>

      How to reproduce the issue using our tutorial deployment?

      <Your answer>

      Feature request or enhancement

      For feature requests or enhancements, provide this information, please:

      Which use case/requirement will be addressed by the proposed feature?

      <Your answer>

      Implementation ideas (optional)

      <Your answer>

            Unassigned Unassigned
            rodirz Rodi Reich Zilberman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: