Casel Chen
Casel Chen

Reputation: 547

Does debezium support capture postgres schema change event?

Does debezium support capture postgres schema change like 'alter table xxx add/drop/alter column xxx'?

Upvotes: 1

Views: 4167

Answers (2)

John Allers
John Allers

Reputation: 3122

No. Debezium does not capture individual schema change events for PostgreSQL, so the schema history is not accessible via a Kafka Topic as it is for other connectors.

PostgreSQL connector limitation:

Logical decoding does not support DDL changes. This means that the connector is unable to report DDL change events back to consumers.

Source

Also see Capture schema changes (DDL) from source to sink.

However, the updated schema is reflected in the individual data change events that follow the schema change.

Upvotes: 1

liorsolomon
liorsolomon

Reputation: 1883

Seems like an old question but in any way the short answer is yes. checkout the documentation here https://debezium.io/documentation/reference/connectors/postgresql.html . With some exceptions:

The PostgreSQL connector retrieves schema information as part of the events sent by the logical decoding plug-in. However, the connector does not retrieve information about which columns compose the primary key. The connector obtains this information from the JDBC metadata (side channel). If the primary key definition of a table changes (by adding, removing or renaming primary key columns), there is a tiny period of time when the primary key information from JDBC is not synchronized with the change event that the logical decoding plug-in generates. During this tiny period, a message could be created with an inconsistent key structure. To prevent this inconsistency, update primary key structures as follows:

Put the database or an application into a read-only mode.
Let Debezium process all remaining events. Stop Debezium.
Update the primary key definition in the relevant table.
Put the database or the application into read/write mode.
Restart Debezium.

Upvotes: 4

Related Questions