Data Types & Precision

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Most migrations do not fail because an event is lost. They fail because an event arrives with a value that is almost right: a price of 24.990000000000002, a delivery date one hour early, a timestamp truncated to milliseconds, a book description replaced by __debezium_unavailable_value, or a flag column that is 'Y' in Oracle and 1 in the mirror table. None of these raises an error. They are found during reconciliation, or by a customer.

Debezium has to map every source column type to a Kafka Connect schema type, and every consumer (the JDBC sink, the anti-corruption layer in the new application) has to map it again to the target database. Each step has defaults and each default has a reason, but the defaults are not always right for a migration. This page explains how Debezium represents numbers, temporal values, binary data and large objects; which connector properties change that; what is special about Oracle, PostgreSQL and MySQL; and how the JDBC sink uses the information. It ends with the mapping of every Bookshop legacy Oracle column to the new PostgreSQL model, the Java conversions used by the anti-corruption layer, and SQL queries that check the result.

Checked on 2026-11-09 against Debezium 3.7.1.Final, Oracle AI Database 26ai Free (image gvenzl/oracle-free:23.26.3, PDB FREEPDB1) and PostgreSQL 18. The type mappings and property values come from the "Data type mappings" and "Connector properties" sections of the official connector pages. The event types that the Bookshop mapping table lists for the canonical configuration (decimal.handling.mode=string) match the events captured in the Worked Example: Oracle to PostgreSQL run on 2026-11-09. The Java conversion class on this page was compiled and run with Java 21. The other connector fragments and the SQL queries were derived from the official documentation and were not run against Oracle or PostgreSQL.

Literal types and semantic types

For each column, a Debezium connector chooses two things:

  • a literal type, the Kafka Connect schema type that holds the value: INT8, INT16, INT32, INT64, FLOAT32, FLOAT64, BOOLEAN, STRING, BYTES, ARRAY, MAP or STRUCT, and

  • in many cases a semantic type, the name of the field’s schema, which says how to interpret the literal value. For example, an INT64 named io.debezium.time.Timestamp is milliseconds since the epoch, while an INT64 named io.debezium.time.MicroTimestamp is microseconds.

The semantic type lives in the schema, not in the payload. A consumer that reads JSON without schemas sees only the literal value (1557792000000) and has to know from elsewhere what it means. This is why Serialization & Schema Registries recommends keeping schemas (JSON with schemas or Avro) for any pipeline that writes to another database.

Debezium uses three families of semantic types:

Family Examples

Kafka Connect logical types

org.apache.kafka.connect.data.Decimal, org.apache.kafka.connect.data.Date, org.apache.kafka.connect.data.Time, org.apache.kafka.connect.data.Timestamp

Debezium temporal types

io.debezium.time.Date, io.debezium.time.Timestamp, io.debezium.time.MicroTimestamp, io.debezium.time.NanoTimestamp, io.debezium.time.ZonedTimestamp, io.debezium.time.IsoTimestamp, io.debezium.time.MicroDuration, io.debezium.time.StructuredTimestamp

Debezium data types

io.debezium.data.VariableScaleDecimal, io.debezium.data.Json, io.debezium.data.Xml, io.debezium.data.Enum, io.debezium.data.EnumSet, io.debezium.data.Bits

Three connector properties change these mappings for whole families of types: decimal.handling.mode, time.precision.mode and binary.handling.mode. Custom converters change them for selected columns (see Custom Converters & Post Processors).

Numbers and decimal.handling.mode

Money is the column type that matters most in a migration and the one that is easiest to damage. Debezium has three ways to represent exact numeric types (Oracle NUMBER, DECIMAL, NUMERIC; PostgreSQL NUMERIC, DECIMAL, MONEY; MySQL DECIMAL, NUMERIC), selected with decimal.handling.mode:

Value Representation Advantages Risks

precise (default)

BYTES with the org.apache.kafka.connect.data.Decimal logical type: the unscaled value as big-endian two’s complement, the scale as a schema parameter. In JSON the bytes are base64 (24.99 is "CcM=").

Exact. The JDBC sink creates numeric columns with the right precision and scale.

Unreadable without the schema. A consumer that hard-codes the scale breaks when the column changes.

double

FLOAT64

Easy for any consumer.

Loses precision. 24.99 cannot be stored exactly in binary floating point, and sums of many values drift. Never use it for money.

string

STRING with the formatted value ("24.99")

Exact and readable without the schema.

The numeric type information is gone, so a JDBC sink that creates its own tables creates text columns. Pre-create the target columns as numeric and let PostgreSQL cast the strings. Consumers must parse and validate.

For the Bookshop pipeline the choice is string. The bookshop-oracle-source connector sets decimal.handling.mode=string, so every price arrives as an exact, readable value such as "24.99" and the Spring Boot consumers parse it with new BigDecimal(...), with no scale to look up. The JDBC sink does not create the mirror tables: they are created beforehand with numeric(10,2) and bigint columns, and the sink’s JDBC URL ends in ?stringtype=unspecified, so PostgreSQL casts the string parameters to the column types (without it, the insert fails with "column …​ is of type bigint but expression is of type character varying"). precise is the sound alternative when the sink must create its own tables from the event schema, or when consumers are generic tools that read the Decimal logical type.

Oracle NUMBER, with and without precision

The Oracle NUMBER type is the source of most numeric surprises, because legacy schemas use it for everything: identifiers, counters, flags and money, often without any precision. With decimal.handling.mode=precise (the default) the Oracle connector maps it as follows:

Oracle declaration Literal type Semantic type and notes

NUMBER(P, S) with S of 0 or less (integer)

INT8, INT16, INT32, INT64 or BYTES

Chosen by P - S: below 3 is INT8, below 5 is INT16, below 10 is INT32, below 19 is INT64, 19 or more is BYTES with Decimal. So NUMBER(10) is INT64 and NUMBER(4) is INT16. A negative scale means rounding in Oracle (NUMBER(10,-2) rounds to hundreds).

NUMBER(P, S) with S greater than 0

BYTES

org.apache.kafka.connect.data.Decimal with that scale. NUMBER(10,2) is a decimal with scale 2.

NUMBER without precision, NUMBER(*), FLOAT, REAL, DOUBLE PRECISION

STRUCT

io.debezium.data.VariableScaleDecimal: a structure with scale (INT32) and value (BYTES, unscaled), because every value can have a different scale.

INTEGER, INT, SMALLINT

BYTES

Decimal. Oracle stores these as NUMBER(38,0), which does not fit in an INT64.

BINARY_FLOAT, BINARY_DOUBLE

FLOAT32, FLOAT64

Binary floating point in Oracle already, so nothing is lost.

With decimal.handling.mode=string, the canonical Bookshop setting, the table above does not apply to the Bookshop columns: every Oracle NUMBER, including the integer columns and the primary keys, arrives as a STRING. The events of the worked example show "BOOK_ID":"1" in the key, "AUTHOR_ID":"1" and "PRICE":"10.06" in the value, all with the schema type string. Consumers therefore parse identifiers with Long.parseLong and amounts with new BigDecimal, and a consumer written against precise events (expecting a JSON number for BOOK_ID) breaks when the mode changes.

Two consequences of the precise mapping matter for a migration:

  • A legacy column declared as plain NUMBER becomes a VariableScaleDecimal structure. The Debezium JDBC sink maps io.debezium.data.VariableScaleDecimal to a DOUBLE column, so an unconstrained NUMBER that holds money silently becomes a floating-point column in the mirror table. Either pre-create the mirror column as numeric and let the consumer convert, or set decimal.handling.mode=string and cast in PostgreSQL, or ask the DBA what the real precision is and handle the column with a custom converter.

  • Avro does not allow a negative scale in its decimal type. A NUMBER(P, S) with a negative scale and a large enough precision becomes a Decimal with negative scale, which can fail to serialize with some registries. Debezium’s NumberToZeroScaleConverter rewrites such values to a zero-scale decimal.

NumberToZeroScaleConverter for Oracle numbers with negative scale (Oracle connector fragment, not used by the Bookshop source)
{
  "converters": "zero_scale",
  "zero_scale.type": "io.debezium.connector.oracle.converters.NumberToZeroScaleConverter",
  "zero_scale.decimal.mode": "precise"
}

PostgreSQL and MySQL decimals

The PostgreSQL connector maps NUMERIC(M,D), DECIMAL(M,D) and MONEY to Decimal in precise mode. The scale of MONEY comes from the money.fraction.digits property. A NUMERIC or DECIMAL without a scale becomes a VariableScaleDecimal, exactly like Oracle’s plain NUMBER, with the same JDBC sink consequence. In double and string modes, PostgreSQL’s special value NaN is emitted as Double.NaN or the string NAN.

The MySQL connector maps DECIMAL and NUMERIC to Decimal in precise mode and has one more numeric property, bigint.unsigned.handling.mode. Its default, long, represents BIGINT UNSIGNED as a signed 64-bit integer, so values above 263 - 1 arrive as negative numbers. Set it to precise (a Decimal) when unsigned identifiers can be that large.

Temporal values and time.precision.mode

Temporal columns combine two problems: precision (milliseconds, microseconds, nanoseconds) and time zones. Debezium controls the first with time.precision.mode. The values available differ per connector:

Value Oracle PostgreSQL MySQL SQL Server

adaptive: the precision follows the column type (Timestamp, MicroTimestamp or NanoTimestamp)

Default

Default

Deprecated

Default

adaptive_time_microseconds: like adaptive, but TIME is always microseconds

 — 

Yes

Default

 — 

connect: Kafka Connect’s Date, Time and Timestamp, always milliseconds

Yes

Yes

Yes

Yes

isostring: ISO 8601 strings in UTC (IsoDate, IsoTime, IsoTimestamp)

Yes

Yes

Yes

Yes

microseconds: always microseconds

Yes

Yes

 — 

 — 

nanoseconds: always nanoseconds

Yes

Yes

 — 

 — 

structured: structs with separate calendar and clock fields

Yes

Yes

Yes

Yes

For the Oracle connector, the modes are described in the "Temporal types" section of the connector page rather than in its property table.

Choose the mode by asking what the target needs:

  • adaptive keeps every value exact, at the cost of three different semantic types for timestamps. Consumers must look at the schema name to know the unit. This is the right default for a migration.

  • connect truncates to milliseconds. It is only safe when no source column has more than millisecond precision, which rules out Oracle TIMESTAMP (6 fractional digits by default). It is also unsafe for Oracle DATE columns that hold points in time: in connect mode the Oracle connector maps DATE to org.apache.kafka.connect.data.Date, a number of days, and drops the time part (see the next section).

  • isostring is easy to read and can represent values outside the range of epoch-based integers.

  • structured keeps every component separately, and the Debezium JDBC sink understands it. It is the only mode that can represent PostgreSQL’s infinity dates directly.

Oracle DATE and TIMESTAMP

The Oracle DATE type always has a time part (to the second) and no time zone. Legacy applications use it both for calendar dates (PUBLISHED, where the time is midnight) and for points in time (LAST_UPD, set with SYSDATE). With the default adaptive mode, the Oracle connector maps:

Oracle type Literal type Semantic type

DATE

INT64

io.debezium.time.Timestamp: milliseconds since the epoch, no time zone

TIMESTAMP(0) to TIMESTAMP(3)

INT64

io.debezium.time.Timestamp

TIMESTAMP, TIMESTAMP(4) to TIMESTAMP(6)

INT64

io.debezium.time.MicroTimestamp: microseconds since the epoch

TIMESTAMP(7) to TIMESTAMP(9)

INT64

io.debezium.time.NanoTimestamp: nanoseconds since the epoch

TIMESTAMP WITH TIME ZONE

STRING

io.debezium.time.ZonedTimestamp: a string with the time zone offset

TIMESTAMP WITH LOCAL TIME ZONE

STRING

io.debezium.time.ZonedTimestamp: a string in UTC

INTERVAL DAY TO SECOND, INTERVAL YEAR TO MONTH

FLOAT64

io.debezium.time.MicroDuration, or io.debezium.time.Interval strings with interval.handling.mode=string

Note the change in the connect mode: Oracle DATE then becomes org.apache.kafka.connect.data.Date, a number of days, so the time part of LAST_UPD is lost.

io.debezium.time.NanoTimestamp is a signed 64-bit count of nanoseconds and can only represent dates between about 1677-09-21 and 2262-04-11. Legacy databases often use 9999-12-31 as an "end of time" value. In a TIMESTAMP(7) to TIMESTAMP(9) column that value cannot be represented. The connector then follows event.converting.failure.handling.mode: with warn (the default) or skip, the value is emitted as null and a warning is logged, and with fail, the connector stops. A null where the legacy row has 9999-12-31 is a silent data change. Use time.precision.mode=microseconds or isostring for such columns, or search for these values before the snapshot (see Verifying the mapping).

Time zones

Oracle DATE and TIMESTAMP and PostgreSQL timestamp store wall-clock time without a time zone. Debezium converts such values to epoch-based numbers as if they were UTC, and the time zone of the Kafka Connect JVM does not change that. A LAST_UPD of 2026-11-09 10:42:07, written by a legacy application running in Madrid, arrives as 1794220927000, which is 10:42:07 UTC, although the real moment was 09:42:07 UTC.

The new model stores updated_at as timestamptz, an absolute point in time. So somebody has to decide in which zone the legacy values were written, and convert. Three places can do it:

  • The anti-corruption layer (recommended): interpret the epoch value as a local date-time and attach the legacy zone, Europe/Madrid in the Bookshop example. The conversion is explicit and testable, and handles daylight saving time correctly. The LegacyColumnRules.instant method in Conversions in the anti-corruption layer does this.

  • PostgreSQL: write the mirror column as timestamp and convert in SQL with updated_at AT TIME ZONE 'Europe/Madrid' when moving data from legacy_book into book.

  • A single message transformation: Debezium’s TimezoneConverter SMT converts temporal fields from UTC to a target zone.

The TimezoneConverter assumes that the field values are in UTC and converts them to the zone given in converted.timezone, which can be a geographic zone (America/New_York) or a fixed offset (+02:00). Use a geographic zone when daylight saving time matters. include.list or exclude.list (not both) select the fields, with rules such as source:<tablename>:<fieldname> or topic:<topicname>:<fieldname>. It is the right tool when the event values are UTC and a consumer wants them in local time, for example for TIMESTAMP WITH TIME ZONE values that consumers display in a single zone. It is not a tool for reinterpreting legacy wall-clock values, because it shifts in the opposite direction.

TimezoneConverter SMT for selected Bookshop fields (optional Oracle connector fragment)
{
  "transforms": "convertTimezone",
  "transforms.convertTimezone.type": "io.debezium.transforms.TimezoneConverter",
  "transforms.convertTimezone.converted.timezone": "Europe/Madrid",
  "transforms.convertTimezone.include.list": "source:SUPPLIER_CATALOGUE:after.FEED_TS"
}

In this example, only FEED_TS of SUPPLIER_CATALOGUE is converted, and only in the after image. The supplier feed writes FEED_TS in UTC, so the SMT shows it in Madrid time. The canonical bookshop-oracle-source configuration does not include this SMT: it is shown for consumers that need local time. Keep the decision about each legacy temporal column (calendar date, local wall-clock time or UTC) in the mapping table below, because nothing in the data reveals it.

Binary data and binary.handling.mode

binary.handling.mode controls how binary columns (Oracle BLOB and RAW, PostgreSQL bytea, MySQL BINARY, VARBINARY and BLOB) are represented:

Value Representation

bytes (default)

BYTES. JSON shows it as base64.

base64

A base64-encoded STRING.

base64-url-safe

A base64-url-safe-encoded STRING.

hex

A hex-encoded (base16) STRING.

Keep bytes when the target column is binary (bytea in PostgreSQL), because the JDBC sink then writes raw bytes. Use hex or base64 only when the target is a text column or a consumer that cannot handle bytes. For RAW columns that hold text-like identifiers (GUIDs generated by SYS_GUID()), the Oracle connector also has a RawToStringConverter.

Large objects and unavailable values

Some values are not in the change stream even though the column exists. Debezium cannot read them later from the database without race conditions, so it emits a placeholder. The placeholder is the value of unavailable.value.placeholder, by default __debezium_unavailable_value. For binary columns the placeholder is emitted as the bytes of that string.

Oracle CLOB, NCLOB and BLOB

The Oracle connector maps CLOB and NCLOB to STRING and BLOB to BYTES (or a string, depending on binary.handling.mode). BFILE, LONG and LONG RAW are not supported. How LOB values reach the event depends on lob.enabled:

  • With lob.enabled=false (the default), snapshot events contain the current LOB values, but streamed events contain the placeholder for every LOB column. LogMiner does not mine the LOB-specific redo entries, which saves a lot of work.

  • With lob.enabled=true, the connector mines the extra redo operations that Oracle writes for LOB changes. Even then, Oracle writes a LOB value to the redo log only when a statement sets or changes it. An update that does not touch the LOB column produces an event with the placeholder in that column. An update that changes the LOB has the new value in after and the placeholder in before.

lob.enabled=true also captures XMLTYPE, JSON (Oracle 21c and later) and extended strings (VARCHAR2, NVARCHAR2 and RAW longer than the legacy limits when MAX_STRING_SIZE=EXTENDED).

For a migration, this has a direct consequence. A consumer or sink that copies every column from after to the target will overwrite a real description with __debezium_unavailable_value the first time the legacy application updates the price of a book. The fixes are:

  1. Skip the placeholder in the consumer: never write a column whose value is the placeholder, and keep the target value instead. The anti-corruption layer can do this. The JDBC sink writes whatever it receives.

  2. Re-select the value with the reselect columns post processor, which queries the source table for columns that carry the placeholder (or null) and puts the current value into the event. The Oracle documentation names this as the alternative to mining LOBs.

  3. Enable LOB mining with lob.enabled=true and accept the extra redo processing, and still handle the placeholder for updates that do not touch the LOB.

Reselect LOB columns instead of mining them (Oracle connector fragment, hypothetical LOB table)
{
  "lob.enabled": "false",
  "unavailable.value.placeholder": "__debezium_unavailable_value",
  "post.processors": "reselector",
  "post.processors.reselector.type": "io.debezium.processors.reselect.ReselectColumnsPostProcessor",
  "post.processors.reselector.reselect.columns.include.list": "BOOKSHOP.BOOK_DESCRIPTION:DESCRIPTION",
  "post.processors.reselector.reselect.unavailable.values": "true",
  "post.processors.reselector.reselect.null.values": "false"
}

The canonical Bookshop schema has no LOB columns, so the example uses a hypothetical BOOKSHOP.BOOK_DESCRIPTION table with a DESCRIPTION CLOB column. The re-selected value is the value at the time of the query, not at the time of the change, which is acceptable for a mirror that converges to the current state but not for an audit trail. If the legacy application uses ROLLBACK TO SAVEPOINT in transactions that change LOB columns, also set log.mining.include.internal.events=true, whatever the lob.enabled setting. The Oracle LOB settings are discussed in more detail on Oracle Connector, and post processors on Custom Converters & Post Processors.

lob.enabled and the placeholder (Oracle connector fragment)
{
  "lob.enabled": "true",
  "unavailable.value.placeholder": "__debezium_unavailable_value"
}

PostgreSQL TOAST and REPLICA IDENTITY

PostgreSQL stores values larger than about 8 KB out of line, with its TOAST mechanism. When a row is updated and a TOASTed column does not change, logical decoding does not include that column, unless it is part of the table’s replica identity. The PostgreSQL connector then emits unavailable.value.placeholder in its place. The replica identity also decides what before contains:

REPLICA IDENTITY before image of UPDATE and DELETE events

DEFAULT

Only the primary key columns. Tables without a primary key produce only create events. Unchanged TOAST columns are missing and replaced by the placeholder.

NOTHING

No previous values.

FULL

All columns, including TOAST columns.

INDEX index-name

The columns of the given index.

In the Bookshop migration PostgreSQL is the source during reverse replication, when the bookshop-pg-source connector feeds changes from the new database back to Oracle (see Cut-over & Reverse Replication). The reverse sink needs complete rows to update Oracle, so the captured tables get REPLICA IDENTITY FULL.

REPLICA IDENTITY FULL on the tables captured by bookshop-pg-source (PostgreSQL 18)
ALTER TABLE public.book         REPLICA IDENTITY FULL;
ALTER TABLE public.author       REPLICA IDENTITY FULL;
ALTER TABLE public.book_author  REPLICA IDENTITY FULL;
ALTER TABLE public.customer     REPLICA IDENTITY FULL;

-- Check: 'f' means FULL, 'd' DEFAULT, 'n' NOTHING, 'i' INDEX
SELECT relname, relreplident
  FROM pg_class
 WHERE relname IN ('book', 'author', 'book_author', 'customer');

FULL makes PostgreSQL write the whole old row to the WAL for every update and delete, which increases WAL volume. For tables with large TOASTed columns that change rarely, the reselect post processor is an alternative.

MySQL: TINYINT(1), ENUM and SET

MySQL is not part of the Bookshop example, but its type quirks often appear when a second legacy system is migrated.

BOOLEAN and TINYINT(1). MySQL stores BOOLEAN as TINYINT(1). During streaming, Debezium sees the original DDL and can map BOOLEAN columns properly. During a snapshot it reads the table definition with SHOW CREATE TABLE, which reports TINYINT(1) for both, so the same column can change its schema between the snapshot and streaming. The TinyIntOneToBooleanConverter makes the mapping consistent.

TinyIntOneToBooleanConverter for MySQL flag columns (MySQL connector fragment)
{
  "converters": "boolean",
  "boolean.type": "io.debezium.connector.binlog.converters.TinyIntOneToBooleanConverter",
  "boolean.selector": "shop.product.is_active,shop.customer.newsletter"
}

Without a selector, the converter maps all TINYINT(1) columns, which is wrong if some of them hold small numbers. If the database does not report the length of TINYINT UNSIGNED columns during the snapshot, set boolean.length.checker=false and list the columns in the selector.

ENUM and SET. MySQL ENUM becomes a STRING with the semantic type io.debezium.data.Enum, and SET becomes io.debezium.data.EnumSet. The schema parameter allowed lists the permitted values. A consumer can use it to validate values, and the JDBC sink uses it when the target is MySQL. Adding a value to an ENUM in the source changes the schema, which a schema registry sees as a new version.

Oracle flags and BOOLEAN

Oracle had no BOOLEAN column type before Oracle Database 23ai, so legacy schemas simulate it with CHAR(1) ('Y', 'N') or NUMBER(1) (1, 0). Oracle 23ai and later (including 26ai) add a native BOOLEAN type, but the Debezium Oracle connector does not support it, so do not convert legacy flag columns to BOOLEAN in Oracle during the migration.

For NUMBER(1) flags, Debezium provides NumberOneToBooleanConverter, which maps selected (or all) NUMBER(1) columns to BOOLEAN.

NumberOneToBooleanConverter for NUMBER(1) flag columns (Oracle connector fragment)
{
  "converters": "boolean",
  "boolean.type": "io.debezium.connector.oracle.converters.NumberOneToBooleanConverter",
  "boolean.selector": ".*\\.ORDERS\\.IS_GIFT"
}

The example column ORDERS.IS_GIFT is hypothetical. The Bookshop flags are CHAR(1) columns (BOOK.ACTIVE_FLG, CUSTOMER.STATUS_CD), which this converter does not handle. They arrive as strings and are translated in the anti-corruption layer, where an unexpected value ('y', ' ', 'X') can be reported instead of silently becoming false.

Keeping the source type for the JDBC sink

The JDBC sink creates and alters target columns from the event schema. From the literal and semantic types alone it cannot know that a STRING came from VARCHAR2(13) or that an INT64 came from NUMBER(10), so it chooses generic types. Two source connector properties add the original type to the field schema:

  • column.propagate.source.type: a comma-separated list of regular expressions that match fully-qualified column names (<schemaName>.<tableName>.<columnName> or <tableName>.<columnName>).

  • datatype.propagate.source.type: a comma-separated list of regular expressions that match data type names.

For each matching column, the field schema gets the parameters __debezium.source.column.type, __debezium.source.column.length and __debezium.source.column.scale.

Propagate the source types of the mirrored Bookshop tables (optional Oracle connector fragment)
{
  "column.propagate.source.type": "BOOKSHOP\\.BOOK\\..*,BOOKSHOP\\.AUTHOR\\..*,BOOKSHOP\\.SUPPLIER_CATALOGUE\\..*"
}

With propagation, the field schema of ISBN looks like this:

Field schema of ISBN with column.propagate.source.type
{
  "type": "string",
  "optional": true,
  "field": "ISBN",
  "parameters": {
    "__debezium.source.column.type": "VARCHAR2",
    "__debezium.source.column.length": "13"
  }
}

The JDBC sink uses these parameters to refine the column type, for example to size character columns. The documentation notes that propagation has the most effect when the source and the sink are the same kind of database. Between Oracle and PostgreSQL the type names differ, so the most reliable approach is still to create the mirror tables yourself with explicit types and let the sink only write rows (see JDBC Sink Connector). The parameters also help hand-written consumers, which can read the original length and scale from the schema instead of hard-coding them.

The Bookshop mapping: Oracle to PostgreSQL

The table lists every column of the legacy BOOKSHOP schema, how the Oracle connector represents it with the canonical configuration used on these pages (decimal.handling.mode=string, default adaptive temporal mode, binary.handling.mode=bytes), and where it ends up in PostgreSQL: the mirror table written 1:1 by the JDBC sink (only for BOOK, AUTHOR and SUPPLIER_CATALOGUE) and the column of the new model written by the anti-corruption layer.

Oracle column Debezium event type Mirror column New model column and conversion

BOOK

BOOK_ID NUMBER(10) PK

STRING

book_id bigint

book.id bigint. Unchanged. Also book_author.book_id.

ISBN VARCHAR2(13)

STRING

isbn varchar(13)

book.isbn text. Trim, validate the check digit, keep null if invalid and report it.

TITLE VARCHAR2(200)

STRING

title varchar(200)

book.title text.

AUTHOR_ID NUMBER(10)

STRING

author_id bigint

A book_author (book_id, author_id) row. The legacy model allows one author per book, the new model many.

PRICE NUMBER(10,2)

STRING, for example "24.99"

price numeric(10,2)

book.price numeric(12,2). Widening, no rounding.

CURRENCY CHAR(3)

STRING

currency char(3)

book.currency char(3). Oracle CHAR is blank-padded, so trim and check against ISO 4217 codes.

PUBLISHED DATE

INT64, io.debezium.time.Timestamp

published timestamp

book.published_on date. Must be midnight; any time part is a data error.

ACTIVE_FLG CHAR(1)

STRING

active_flg char(1)

book.active boolean. 'Y' is true, 'N' is false, anything else is an error.

SUPPLIER_ID NUMBER(10)

STRING

supplier_id bigint

book.supplier_id bigint.

LAST_UPD DATE

INT64, io.debezium.time.Timestamp

last_upd timestamp

book.updated_at timestamptz. Wall-clock time in Europe/Madrid, converted to an instant.

AUTHOR

AUTHOR_ID NUMBER(10) PK

STRING

author_id bigint

author.id bigint.

FULL_NAME VARCHAR2(200)

STRING

full_name varchar(200)

author.full_name text.

CUSTOMER (no mirror table)

CUST_ID NUMBER(10) PK

STRING

 — 

customer.legacy_id bigint. customer.id uuid is generated once per legacy ID and never changes.

CUST_NAME VARCHAR2(200)

STRING

 — 

customer.name text.

EMAIL VARCHAR2(320)

STRING

 — 

customer.email text. Trim and lower-case only if the new application compares e-mails that way.

STATUS_CD CHAR(1)

STRING

 — 

customer.status text. 'A' is ACTIVE, 'I' is INACTIVE.

CREATED_DT DATE

INT64, io.debezium.time.Timestamp

 — 

customer.created_at timestamptz. Legacy zone conversion.

ORDERS (no mirror table)

ORDER_ID NUMBER(12) PK

STRING

 — 

purchase_order.legacy_id bigint. purchase_order.id uuid is generated.

CUST_ID NUMBER(10)

STRING

 — 

purchase_order.customer_id uuid, looked up from customer.legacy_id.

ORDER_DT DATE

INT64, io.debezium.time.Timestamp

 — 

purchase_order.placed_at timestamptz. Legacy zone conversion.

STATUS_CD VARCHAR2(2)

STRING

 — 

purchase_order.status text. NW, PD, SH, CN become NEW, PAID, SHIPPED, CANCELLED.

TOTAL_AMT NUMBER(12,2)

STRING, for example "24.99"

 — 

purchase_order.total numeric(12,2).

ORDER_LINE (no mirror table)

ORDER_ID NUMBER(12) PK

STRING

 — 

order_line.order_id uuid, looked up from purchase_order.legacy_id.

LINE_NO NUMBER(4) PK

STRING

 — 

order_line.line_no int.

BOOK_ID NUMBER(10)

STRING

 — 

order_line.book_id bigint.

QTY NUMBER(5)

STRING

 — 

order_line.quantity int.

UNIT_PRICE NUMBER(10,2)

STRING, for example "24.99"

 — 

order_line.unit_price numeric(12,2).

SUPPLIER_CATALOGUE (mirror only; no table in the new model)

SUPPLIER_ID NUMBER(10) PK

STRING

supplier_id bigint

 — 

ISBN VARCHAR2(13) PK

STRING

isbn varchar(13)

 — 

SUPPLIER_PRICE NUMBER(10,2)

STRING, for example "24.99"

supplier_price numeric(10,2)

 — 

FEED_TS TIMESTAMP

INT64, io.debezium.time.MicroTimestamp

feed_ts timestamp

 — (UTC, written by the supplier feed)

With decimal.handling.mode=string every NUMBER column is a STRING, whatever its precision and scale. With precise the integer columns would follow the rule from Oracle NUMBER, with and without precision (NUMBER(10) and NUMBER(12) become INT64, NUMBER(5) becomes INT32, NUMBER(4) becomes INT16) and the amounts would be Decimal values with scale 2. The temporal types do not depend on decimal.handling.mode: Oracle DATE is a io.debezium.time.Timestamp, and Oracle TIMESTAMP without a precision has 6 fractional digits, so FEED_TS is a MicroTimestamp.

The mirror tables are created before the JDBC sink starts, with these explicit types, and the sink only writes rows (schema.evolution=none). The string values of the NUMBER columns reach bigint and numeric(10,2) columns because the sink’s JDBC URL ends in ?stringtype=unspecified. With quote.identifiers=false PostgreSQL folds the names to lower case, which matches the legacy_${source.table} collection name format once lower-cased. The DDL is the same as on JDBC Sink Connector and in the worked example.

Mirror tables for the JDBC sink (PostgreSQL 18, database bookshop)
CREATE ROLE bookshop_mirror LOGIN PASSWORD 'change-me';

CREATE TABLE legacy_book (
    book_id      bigint        PRIMARY KEY,   -- NUMBER(10)
    isbn         varchar(13),                 -- VARCHAR2(13)
    title        varchar(200),
    author_id    bigint,                      -- NUMBER(10)
    price        numeric(10,2),               -- NUMBER(10,2)
    currency     char(3),
    published    timestamp,                   -- DATE -> io.debezium.time.Timestamp
    active_flg   char(1),                     -- 'Y' / 'N', kept as in the legacy table
    supplier_id  bigint,
    last_upd     timestamp
);

CREATE TABLE legacy_author (
    author_id    bigint        PRIMARY KEY,
    full_name    varchar(200)
);

CREATE TABLE legacy_supplier_catalogue (
    supplier_id    bigint,
    isbn           varchar(13),
    supplier_price numeric(10,2),
    feed_ts        timestamp,                 -- TIMESTAMP(6) -> io.debezium.time.MicroTimestamp
    PRIMARY KEY (supplier_id, isbn)
);

GRANT SELECT, INSERT, UPDATE, DELETE ON legacy_book, legacy_author, legacy_supplier_catalogue TO bookshop_mirror;

The mirror keeps the legacy types exactly: timestamp without time zone for Oracle DATE, numeric(10,2) for NUMBER(10,2), char(1) for the flags. All semantic conversions happen in one place, the anti-corruption layer, where they can be tested.

Conversions in the anti-corruption layer

The translators of the Spring Boot bookshop application (LegacyBookTranslator, LegacyCustomerTranslator, LegacyOrderProjector) share the value conversions from the mapping table. In the application they live in the LegacyValues and LegacyCodes classes shown on Listening to Events in Applications, which read the values from the Jackson tree of the event. The class below states the same rules on plain values, so that each decision of the mapping table can be read and unit tested on its own: which zone the legacy dates are in, which flag values are valid, how the strings of decimal.handling.mode=string are parsed, and what to do with the placeholder.

LegacyColumnRules.java: value conversions for the Bookshop legacy columns
package com.example.bookshop.migration;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.Base64;
import java.util.Map;

/**
 * Converts values of the legacy Oracle BOOKSHOP schema, as Debezium emits them with the canonical
 * decimal.handling.mode=string and the default time.precision.mode=adaptive, into the types of the new
 * PostgreSQL model. The translators of the anti-corruption layer apply the same rules.
 */
public final class LegacyColumnRules {

    /** Time zone in which the legacy application wrote its DATE values (wall-clock time). */
    public static final ZoneId LEGACY_ZONE = ZoneId.of("Europe/Madrid");

    /** Placeholder that the connector emits for LOB or TOAST values it could not read. */
    public static final String UNAVAILABLE = "__debezium_unavailable_value";

    private static final Map<String, String> ORDER_STATUS =
            Map.of("NW", "NEW", "PD", "PAID", "SH", "SHIPPED", "CN", "CANCELLED");

    private LegacyColumnRules() {
    }

    /** Integer NUMBER(p) such as BOOK_ID: a string such as "1001" with decimal.handling.mode=string. */
    public static Long identifier(String text) {
        return text == null ? null : Long.valueOf(text.trim());
    }

    /** NUMBER(p,s) with s greater than 0: a string such as "24.99" with decimal.handling.mode=string. */
    public static BigDecimal decimal(String text) {
        return text == null ? null : new BigDecimal(text.trim());
    }

    /**
     * The same column with decimal.handling.mode=precise (not the Bookshop setting): base64 of the unscaled
     * two's-complement value, with the scale taken from the field schema.
     */
    public static BigDecimal decimalFromPrecise(String base64, int scale) {
        return base64 == null ? null
                : new BigDecimal(new BigInteger(Base64.getDecoder().decode(base64)), scale);
    }

    /** Widens NUMBER(10,2) to numeric(12,2); fails instead of rounding if the scale would be lost. */
    public static BigDecimal money(BigDecimal value) {
        return value == null ? null : value.setScale(2, RoundingMode.UNNECESSARY);
    }

    /** Oracle DATE used as a calendar date (io.debezium.time.Timestamp, epoch milliseconds). */
    public static LocalDate dateOnly(Long epochMillis) {
        if (epochMillis == null) {
            return null;
        }
        LocalDateTime wallClock = LocalDateTime.ofInstant(Instant.ofEpochMilli(epochMillis), ZoneOffset.UTC);
        if (!wallClock.toLocalTime().equals(LocalTime.MIDNIGHT)) {
            throw new IllegalArgumentException("DATE value has a time part: " + wallClock);
        }
        return wallClock.toLocalDate();
    }

    /** Oracle DATE used as a point in time, written in LEGACY_ZONE: becomes a timestamptz value. */
    public static OffsetDateTime instant(Long epochMillis) {
        if (epochMillis == null) {
            return null;
        }
        LocalDateTime wallClock = LocalDateTime.ofInstant(Instant.ofEpochMilli(epochMillis), ZoneOffset.UTC);
        return wallClock.atZone(LEGACY_ZONE).toOffsetDateTime();
    }

    /** CHAR(1) 'Y'/'N' flag: becomes boolean; any other value is a data quality error. */
    public static Boolean flag(String yn) {
        if (yn == null) {
            return null;
        }
        return switch (yn.trim()) {
            case "Y" -> Boolean.TRUE;
            case "N" -> Boolean.FALSE;
            default -> throw new IllegalArgumentException("Unexpected flag value: '" + yn + "'");
        };
    }

    /** ORDERS.STATUS_CD: becomes the status text of purchase_order. */
    public static String orderStatus(String code) {
        String status = code == null ? null : ORDER_STATUS.get(code.trim());
        if (status == null) {
            throw new IllegalArgumentException("Unknown order status code: " + code);
        }
        return status;
    }

    /** CUSTOMER.STATUS_CD 'A'/'I': becomes ACTIVE or INACTIVE. */
    public static String customerStatus(String code) {
        return switch (code == null ? "" : code.trim()) {
            case "A" -> "ACTIVE";
            case "I" -> "INACTIVE";
            default -> throw new IllegalArgumentException("Unknown customer status code: " + code);
        };
    }

    /** True if a LOB or TOAST column was not captured and must not overwrite the target value. */
    public static boolean unavailable(Object value) {
        return UNAVAILABLE.equals(value);
    }
}

With the values of the update event from Anatomy of a Change Event, identifier("1001") returns 1001, decimal("24.99") returns 24.99 (and decimalFromPrecise("CcM=", 2), the same price in precise mode, also returns 24.99), dateOnly(1557792000000L) returns 2019-05-14, and instant(1794220927000L) returns 2026-11-09T10:42:07+01:00 (Madrid is at UTC+1 in November). dateOnly(1794220927000L) throws, because the value has a time part. The conversions fail loudly on unexpected data on purpose: an exception sends the event to the consumer’s error handling (a dead-letter topic in the bookshop application) where it can be inspected, while a silent default would hide the problem. How the translators use these methods, and how failed events are handled, is on Listening to Events in Applications.

If a pipeline uses precise mode with Avro instead, the decimal values arrive as ByteBuffer (or BigDecimal with Avro’s decimal conversion) instead of base64 strings, and only the decimal conversion changes.

Verifying the mapping

Run type checks before the initial snapshot, and again during reconciliation. The queries below find the values that the mapping table calls errors.

Data profile of the legacy BOOKSHOP schema (Oracle, connected to FREEPDB1)
-- Calendar dates that have a time part
SELECT COUNT(*) AS published_with_time
  FROM BOOKSHOP.BOOK
 WHERE PUBLISHED <> TRUNC(PUBLISHED);

-- Flag and status values outside the documented sets
SELECT ACTIVE_FLG, COUNT(*) FROM BOOKSHOP.BOOK GROUP BY ACTIVE_FLG;
SELECT STATUS_CD, COUNT(*) FROM BOOKSHOP.CUSTOMER GROUP BY STATUS_CD;
SELECT STATUS_CD, COUNT(*) FROM BOOKSHOP.ORDERS GROUP BY STATUS_CD;

-- "End of time" sentinels and other extreme dates
SELECT MIN(ORDER_DT), MAX(ORDER_DT) FROM BOOKSHOP.ORDERS;
SELECT MIN(FEED_TS), MAX(FEED_TS) FROM BOOKSHOP.SUPPLIER_CATALOGUE;

-- Columns declared as NUMBER without precision (they become VariableScaleDecimal)
SELECT TABLE_NAME, COLUMN_NAME
  FROM ALL_TAB_COLUMNS
 WHERE OWNER = 'BOOKSHOP' AND DATA_TYPE = 'NUMBER' AND DATA_PRECISION IS NULL;

-- Totals to compare with the mirror table
SELECT COUNT(*), SUM(PRICE) FROM BOOKSHOP.BOOK;
Checks on the mirror and the new model (PostgreSQL 18, database bookshop)
-- Same totals as in Oracle: any difference points at a numeric mapping problem
SELECT COUNT(*), SUM(price) FROM public.legacy_book;

-- Placeholders that reached a table
SELECT COUNT(*) FROM public.legacy_book WHERE title = '__debezium_unavailable_value';

-- Columns that the JDBC sink created as floating point
SELECT table_name, column_name, data_type
  FROM information_schema.columns
 WHERE table_schema = 'public'
   AND table_name LIKE 'legacy\_%'
   AND data_type IN ('double precision', 'real');

-- Time zone conversion: the new model should be one or two hours behind the mirror
SELECT l.book_id, l.last_upd, b.updated_at AT TIME ZONE 'UTC' AS updated_at_utc
  FROM public.legacy_book l
  JOIN public.book b ON b.id = l.book_id
 LIMIT 10;

Row-level comparison and checksums for the whole migration are described in Verification & Reconciliation.

Summary of the properties

Property Default Use in the Bookshop migration

decimal.handling.mode

precise

string (the canonical bookshop-oracle-source setting): exact values that consumers parse, written to pre-created numeric and bigint mirror columns through ?stringtype=unspecified. precise is the alternative when the sink creates its own tables. Never double for money.

time.precision.mode

adaptive (Oracle, PostgreSQL, SQL Server), adaptive_time_microseconds (MySQL)

Keep the default. Use microseconds or isostring if nanosecond columns hold dates outside 1677 to 2262.

binary.handling.mode

bytes

Keep bytes for binary targets.

lob.enabled (Oracle)

false

false plus the reselect post processor, or true with placeholder handling.

unavailable.value.placeholder

__debezium_unavailable_value

Keep the default and filter it in every consumer.

interval.handling.mode

numeric

string if interval columns must be exact.

column.propagate.source.type

none

Not set in the canonical configuration. Optional for the mirrored tables, so consumers and the sink see lengths and scales.

bigint.unsigned.handling.mode (MySQL)

long

precise if unsigned values can exceed 263 - 1.