0

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

Casel Chen
  • 497
  • 2
  • 8
  • 19

1 Answers1

4

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.

liorsolomon
  • 1,785
  • 14
  • 24