pg-cdc-doctor 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. pg_cdc_doctor-0.1.0/.gitignore +9 -0
  2. pg_cdc_doctor-0.1.0/LICENSE +202 -0
  3. pg_cdc_doctor-0.1.0/NOTICE +4 -0
  4. pg_cdc_doctor-0.1.0/PKG-INFO +416 -0
  5. pg_cdc_doctor-0.1.0/README.md +390 -0
  6. pg_cdc_doctor-0.1.0/docs/checks.md +430 -0
  7. pg_cdc_doctor-0.1.0/pyproject.toml +80 -0
  8. pg_cdc_doctor-0.1.0/results/matrix.json +7922 -0
  9. pg_cdc_doctor-0.1.0/results/matrix.md +94 -0
  10. pg_cdc_doctor-0.1.0/scripts/gen_checks_doc.py +28 -0
  11. pg_cdc_doctor-0.1.0/scripts/matrix.py +125 -0
  12. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/__init__.py +5 -0
  13. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/__main__.py +6 -0
  14. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/_version.py +1 -0
  15. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/__init__.py +275 -0
  16. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/_base.py +28 -0
  17. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/catalog.py +798 -0
  18. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/debezium.py +608 -0
  19. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/failover.py +419 -0
  20. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/publication.py +170 -0
  21. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/role.py +69 -0
  22. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/server.py +311 -0
  23. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/slots.py +147 -0
  24. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/checks/tables.py +281 -0
  25. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/cli.py +202 -0
  26. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/connect.py +244 -0
  27. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/debezium.py +282 -0
  28. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/model.py +136 -0
  29. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/py.typed +0 -0
  30. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/report.py +102 -0
  31. pg_cdc_doctor-0.1.0/src/pg_cdc_doctor/util.py +100 -0
  32. pg_cdc_doctor-0.1.0/tests/conftest.py +6 -0
  33. pg_cdc_doctor-0.1.0/tests/fakes.py +24 -0
  34. pg_cdc_doctor-0.1.0/tests/harness.py +742 -0
  35. pg_cdc_doctor-0.1.0/tests/scenarios/cdc001_managed_hints/expect.json +22 -0
  36. pg_cdc_doctor-0.1.0/tests/scenarios/cdc001_managed_hints/setup.sql +2 -0
  37. pg_cdc_doctor-0.1.0/tests/scenarios/cdc001_wal_level_replica/expect.json +16 -0
  38. pg_cdc_doctor-0.1.0/tests/scenarios/cdc001_wal_level_replica/setup.sql +1 -0
  39. pg_cdc_doctor-0.1.0/tests/scenarios/cdc002_no_free_slots/expect.json +13 -0
  40. pg_cdc_doctor-0.1.0/tests/scenarios/cdc002_no_free_slots/setup.sql +3 -0
  41. pg_cdc_doctor-0.1.0/tests/scenarios/cdc002_one_free_slot/expect.json +12 -0
  42. pg_cdc_doctor-0.1.0/tests/scenarios/cdc002_one_free_slot/setup.sql +2 -0
  43. pg_cdc_doctor-0.1.0/tests/scenarios/cdc003_no_free_wal_senders/expect.json +18 -0
  44. pg_cdc_doctor-0.1.0/tests/scenarios/cdc003_no_free_wal_senders/setup.sql +1 -0
  45. pg_cdc_doctor-0.1.0/tests/scenarios/cdc004_unbounded_slot_wal/expect.json +15 -0
  46. pg_cdc_doctor-0.1.0/tests/scenarios/cdc004_unbounded_slot_wal/setup.sql +1 -0
  47. pg_cdc_doctor-0.1.0/tests/scenarios/cdc005_wal_sender_timeout_zero/expect.json +15 -0
  48. pg_cdc_doctor-0.1.0/tests/scenarios/cdc005_wal_sender_timeout_zero/setup.sql +1 -0
  49. pg_cdc_doctor-0.1.0/tests/scenarios/cdc006_no_replication_role/expect.json +17 -0
  50. pg_cdc_doctor-0.1.0/tests/scenarios/cdc006_no_replication_role/setup.sql +3 -0
  51. pg_cdc_doctor-0.1.0/tests/scenarios/cdc006_rds_replication_member/expect.json +13 -0
  52. pg_cdc_doctor-0.1.0/tests/scenarios/cdc006_rds_replication_member/setup.sql +5 -0
  53. pg_cdc_doctor-0.1.0/tests/scenarios/cdc006_replication_attribute/expect.json +14 -0
  54. pg_cdc_doctor-0.1.0/tests/scenarios/cdc006_replication_attribute/setup.sql +3 -0
  55. pg_cdc_doctor-0.1.0/tests/scenarios/cdc007_no_select/expect.json +18 -0
  56. pg_cdc_doctor-0.1.0/tests/scenarios/cdc007_no_select/setup.sql +4 -0
  57. pg_cdc_doctor-0.1.0/tests/scenarios/cdc008_prepared_xact/expect.json +9 -0
  58. pg_cdc_doctor-0.1.0/tests/scenarios/cdc008_prepared_xact/setup.sql +4 -0
  59. pg_cdc_doctor-0.1.0/tests/scenarios/cdc009_long_xact/expect.json +32 -0
  60. pg_cdc_doctor-0.1.0/tests/scenarios/cdc009_long_xact/setup.sql +1 -0
  61. pg_cdc_doctor-0.1.0/tests/scenarios/cdc009_read_only_xact_not_flagged/expect.json +29 -0
  62. pg_cdc_doctor-0.1.0/tests/scenarios/cdc009_read_only_xact_not_flagged/setup.sql +1 -0
  63. pg_cdc_doctor-0.1.0/tests/scenarios/cdc009_short_xact_not_flagged/expect.json +14 -0
  64. pg_cdc_doctor-0.1.0/tests/scenarios/cdc009_short_xact_not_flagged/setup.sql +1 -0
  65. pg_cdc_doctor-0.1.0/tests/scenarios/cdc009_xact_visible_without_stats_role/expect.json +27 -0
  66. pg_cdc_doctor-0.1.0/tests/scenarios/cdc009_xact_visible_without_stats_role/setup.sql +4 -0
  67. pg_cdc_doctor-0.1.0/tests/scenarios/cdc010_end_of_life_version_wording/expect.json +17 -0
  68. pg_cdc_doctor-0.1.0/tests/scenarios/cdc010_end_of_life_version_wording/setup.sql +1 -0
  69. pg_cdc_doctor-0.1.0/tests/scenarios/cdc020_extended/expect.json +13 -0
  70. pg_cdc_doctor-0.1.0/tests/scenarios/cdc020_extended/setup.sql +6 -0
  71. pg_cdc_doctor-0.1.0/tests/scenarios/cdc020_lost/expect.json +15 -0
  72. pg_cdc_doctor-0.1.0/tests/scenarios/cdc020_lost/setup.sql +7 -0
  73. pg_cdc_doctor-0.1.0/tests/scenarios/cdc020_unreserved/expect.json +15 -0
  74. pg_cdc_doctor-0.1.0/tests/scenarios/cdc020_unreserved/setup.sql +9 -0
  75. pg_cdc_doctor-0.1.0/tests/scenarios/cdc021_inactive_slot/expect.json +16 -0
  76. pg_cdc_doctor-0.1.0/tests/scenarios/cdc021_inactive_slot/setup.sql +4 -0
  77. pg_cdc_doctor-0.1.0/tests/scenarios/cdc022_retained_wal_over_limit/expect.json +14 -0
  78. pg_cdc_doctor-0.1.0/tests/scenarios/cdc022_retained_wal_over_limit/setup.sql +4 -0
  79. pg_cdc_doctor-0.1.0/tests/scenarios/cdc023_slot_missing/expect.json +15 -0
  80. pg_cdc_doctor-0.1.0/tests/scenarios/cdc023_slot_missing/setup.sql +1 -0
  81. pg_cdc_doctor-0.1.0/tests/scenarios/cdc023_slot_pgoutput_ok/expect.json +11 -0
  82. pg_cdc_doctor-0.1.0/tests/scenarios/cdc023_slot_pgoutput_ok/setup.sql +1 -0
  83. pg_cdc_doctor-0.1.0/tests/scenarios/cdc023_slot_wrong_plugin/expect.json +13 -0
  84. pg_cdc_doctor-0.1.0/tests/scenarios/cdc023_slot_wrong_plugin/setup.sql +1 -0
  85. pg_cdc_doctor-0.1.0/tests/scenarios/cdc030_index_identity_ok/expect.json +19 -0
  86. pg_cdc_doctor-0.1.0/tests/scenarios/cdc030_index_identity_ok/setup.sql +4 -0
  87. pg_cdc_doctor-0.1.0/tests/scenarios/cdc030_mixed_case_table_fix_is_quoted/expect.json +26 -0
  88. pg_cdc_doctor-0.1.0/tests/scenarios/cdc030_mixed_case_table_fix_is_quoted/setup.sql +2 -0
  89. pg_cdc_doctor-0.1.0/tests/scenarios/cdc030_no_pk_default/expect.json +41 -0
  90. pg_cdc_doctor-0.1.0/tests/scenarios/cdc030_no_pk_default/setup.sql +4 -0
  91. pg_cdc_doctor-0.1.0/tests/scenarios/cdc031_replica_identity_index_dropped/expect.json +30 -0
  92. pg_cdc_doctor-0.1.0/tests/scenarios/cdc031_replica_identity_index_dropped/setup.sql +5 -0
  93. pg_cdc_doctor-0.1.0/tests/scenarios/cdc031_replica_identity_nothing/expect.json +20 -0
  94. pg_cdc_doctor-0.1.0/tests/scenarios/cdc031_replica_identity_nothing/setup.sql +3 -0
  95. pg_cdc_doctor-0.1.0/tests/scenarios/cdc032_replica_identity_full/expect.json +26 -0
  96. pg_cdc_doctor-0.1.0/tests/scenarios/cdc032_replica_identity_full/setup.sql +3 -0
  97. pg_cdc_doctor-0.1.0/tests/scenarios/cdc033_toast_default_identity/expect.json +15 -0
  98. pg_cdc_doctor-0.1.0/tests/scenarios/cdc033_toast_default_identity/setup.sql +4 -0
  99. pg_cdc_doctor-0.1.0/tests/scenarios/cdc034_temp_table_excluded/expect.json +16 -0
  100. pg_cdc_doctor-0.1.0/tests/scenarios/cdc034_temp_table_excluded/setup.sql +1 -0
  101. pg_cdc_doctor-0.1.0/tests/scenarios/cdc034_unlogged_table/expect.json +13 -0
  102. pg_cdc_doctor-0.1.0/tests/scenarios/cdc034_unlogged_table/setup.sql +2 -0
  103. pg_cdc_doctor-0.1.0/tests/scenarios/cdc035_partitioned_not_via_root/expect.json +14 -0
  104. pg_cdc_doctor-0.1.0/tests/scenarios/cdc035_partitioned_not_via_root/setup.sql +4 -0
  105. pg_cdc_doctor-0.1.0/tests/scenarios/cdc035_via_root_ok/expect.json +13 -0
  106. pg_cdc_doctor-0.1.0/tests/scenarios/cdc035_via_root_ok/setup.sql +4 -0
  107. pg_cdc_doctor-0.1.0/tests/scenarios/cdc040_publication_missing/expect.json +14 -0
  108. pg_cdc_doctor-0.1.0/tests/scenarios/cdc040_publication_missing/setup.sql +1 -0
  109. pg_cdc_doctor-0.1.0/tests/scenarios/cdc041_missing_actions/expect.json +17 -0
  110. pg_cdc_doctor-0.1.0/tests/scenarios/cdc041_missing_actions/setup.sql +2 -0
  111. pg_cdc_doctor-0.1.0/tests/scenarios/cdc042_column_list_ok/expect.json +19 -0
  112. pg_cdc_doctor-0.1.0/tests/scenarios/cdc042_column_list_ok/setup.sql +2 -0
  113. pg_cdc_doctor-0.1.0/tests/scenarios/cdc042_column_list_omits_identity/expect.json +21 -0
  114. pg_cdc_doctor-0.1.0/tests/scenarios/cdc042_column_list_omits_identity/setup.sql +2 -0
  115. pg_cdc_doctor-0.1.0/tests/scenarios/cdc042_full_identity_column_list_all/expect.json +28 -0
  116. pg_cdc_doctor-0.1.0/tests/scenarios/cdc042_full_identity_column_list_all/setup.sql +3 -0
  117. pg_cdc_doctor-0.1.0/tests/scenarios/cdc042_full_identity_column_list_subset/expect.json +28 -0
  118. pg_cdc_doctor-0.1.0/tests/scenarios/cdc042_full_identity_column_list_subset/setup.sql +3 -0
  119. pg_cdc_doctor-0.1.0/tests/scenarios/cdc043_row_filter_on_identity_ok/expect.json +19 -0
  120. pg_cdc_doctor-0.1.0/tests/scenarios/cdc043_row_filter_on_identity_ok/setup.sql +2 -0
  121. pg_cdc_doctor-0.1.0/tests/scenarios/cdc043_row_filter_outside_identity/expect.json +21 -0
  122. pg_cdc_doctor-0.1.0/tests/scenarios/cdc043_row_filter_outside_identity/setup.sql +2 -0
  123. pg_cdc_doctor-0.1.0/tests/scenarios/cdc044_table_not_in_publication/expect.json +19 -0
  124. pg_cdc_doctor-0.1.0/tests/scenarios/cdc044_table_not_in_publication/setup.sql +3 -0
  125. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_generated_columns/expect.json +15 -0
  126. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_generated_columns/setup.sql +2 -0
  127. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_generated_columns_pg18_none/expect.json +14 -0
  128. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_generated_columns_pg18_none/setup.sql +2 -0
  129. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_generated_columns_pg18_stored/expect.json +14 -0
  130. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_generated_columns_pg18_stored/setup.sql +2 -0
  131. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_pg18_column_list_names_stored_column/expect.json +23 -0
  132. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_pg18_column_list_names_stored_column/setup.sql +2 -0
  133. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_pg18_column_list_omits_stored_column/expect.json +23 -0
  134. pg_cdc_doctor-0.1.0/tests/scenarios/cdc045_pg18_column_list_omits_stored_column/setup.sql +2 -0
  135. pg_cdc_doctor-0.1.0/tests/scenarios/cdc050_no_failover_before_17/expect.json +20 -0
  136. pg_cdc_doctor-0.1.0/tests/scenarios/cdc050_no_failover_before_17/setup.sql +6 -0
  137. pg_cdc_doctor-0.1.0/tests/scenarios/cdc051_slot_without_failover/expect.json +27 -0
  138. pg_cdc_doctor-0.1.0/tests/scenarios/cdc051_slot_without_failover/setup.sql +8 -0
  139. pg_cdc_doctor-0.1.0/tests/scenarios/cdc052_no_synchronized_standby_slots/expect.json +21 -0
  140. pg_cdc_doctor-0.1.0/tests/scenarios/cdc052_no_synchronized_standby_slots/setup.sql +6 -0
  141. pg_cdc_doctor-0.1.0/tests/scenarios/cdc053_inactive_physical_slot/expect.json +40 -0
  142. pg_cdc_doctor-0.1.0/tests/scenarios/cdc053_inactive_physical_slot/setup.sql +9 -0
  143. pg_cdc_doctor-0.1.0/tests/scenarios/cdc053_logical_slot_named/expect.json +40 -0
  144. pg_cdc_doctor-0.1.0/tests/scenarios/cdc053_logical_slot_named/setup.sql +9 -0
  145. pg_cdc_doctor-0.1.0/tests/scenarios/cdc053_missing_slot/expect.json +40 -0
  146. pg_cdc_doctor-0.1.0/tests/scenarios/cdc053_missing_slot/setup.sql +8 -0
  147. pg_cdc_doctor-0.1.0/tests/scenarios/cdc055_sync_replication_slots_off/expect.json +25 -0
  148. pg_cdc_doctor-0.1.0/tests/scenarios/cdc055_sync_replication_slots_off/setup.sql +8 -0
  149. pg_cdc_doctor-0.1.0/tests/scenarios/cdc056_hot_standby_feedback_off/expect.json +36 -0
  150. pg_cdc_doctor-0.1.0/tests/scenarios/cdc056_hot_standby_feedback_off/setup.sql +8 -0
  151. pg_cdc_doctor-0.1.0/tests/scenarios/cdc056_hot_standby_feedback_off/standby.sql +3 -0
  152. pg_cdc_doctor-0.1.0/tests/scenarios/cdc057_primary_slot_name_empty/expect.json +36 -0
  153. pg_cdc_doctor-0.1.0/tests/scenarios/cdc057_primary_slot_name_empty/setup.sql +8 -0
  154. pg_cdc_doctor-0.1.0/tests/scenarios/cdc057_primary_slot_name_empty/standby.sql +3 -0
  155. pg_cdc_doctor-0.1.0/tests/scenarios/cdc058_conninfo_without_dbname/expect.json +39 -0
  156. pg_cdc_doctor-0.1.0/tests/scenarios/cdc058_conninfo_without_dbname/setup.sql +8 -0
  157. pg_cdc_doctor-0.1.0/tests/scenarios/cdc058_conninfo_without_dbname/standby.sql +3 -0
  158. pg_cdc_doctor-0.1.0/tests/scenarios/cdc059_slot_not_synced/expect.json +28 -0
  159. pg_cdc_doctor-0.1.0/tests/scenarios/cdc059_slot_not_synced/setup.sql +8 -0
  160. pg_cdc_doctor-0.1.0/tests/scenarios/cdc059_slot_not_synced/standby.sql +4 -0
  161. pg_cdc_doctor-0.1.0/tests/scenarios/cdc060_default_plugin_decoderbufs/connector.json +14 -0
  162. pg_cdc_doctor-0.1.0/tests/scenarios/cdc060_default_plugin_decoderbufs/expect.json +16 -0
  163. pg_cdc_doctor-0.1.0/tests/scenarios/cdc060_default_plugin_decoderbufs/setup.sql +4 -0
  164. pg_cdc_doctor-0.1.0/tests/scenarios/cdc061_wrong_database/connector.json +18 -0
  165. pg_cdc_doctor-0.1.0/tests/scenarios/cdc061_wrong_database/expect.json +17 -0
  166. pg_cdc_doctor-0.1.0/tests/scenarios/cdc061_wrong_database/setup.sql +4 -0
  167. pg_cdc_doctor-0.1.0/tests/scenarios/cdc062_all_tables_not_superuser/connector.json +18 -0
  168. pg_cdc_doctor-0.1.0/tests/scenarios/cdc062_all_tables_not_superuser/expect.json +20 -0
  169. pg_cdc_doctor-0.1.0/tests/scenarios/cdc062_all_tables_not_superuser/setup.sql +5 -0
  170. pg_cdc_doctor-0.1.0/tests/scenarios/cdc062_disabled_publication_missing/connector.json +18 -0
  171. pg_cdc_doctor-0.1.0/tests/scenarios/cdc062_disabled_publication_missing/expect.json +17 -0
  172. pg_cdc_doctor-0.1.0/tests/scenarios/cdc062_disabled_publication_missing/setup.sql +3 -0
  173. pg_cdc_doctor-0.1.0/tests/scenarios/cdc062_filtered_not_owner/connector.json +18 -0
  174. pg_cdc_doctor-0.1.0/tests/scenarios/cdc062_filtered_not_owner/expect.json +20 -0
  175. pg_cdc_doctor-0.1.0/tests/scenarios/cdc062_filtered_not_owner/setup.sql +5 -0
  176. pg_cdc_doctor-0.1.0/tests/scenarios/cdc063_filtered_adds_table/connector.json +18 -0
  177. pg_cdc_doctor-0.1.0/tests/scenarios/cdc063_filtered_adds_table/expect.json +15 -0
  178. pg_cdc_doctor-0.1.0/tests/scenarios/cdc063_filtered_adds_table/setup.sql +4 -0
  179. pg_cdc_doctor-0.1.0/tests/scenarios/cdc063_table_missing_from_publication/connector.json +18 -0
  180. pg_cdc_doctor-0.1.0/tests/scenarios/cdc063_table_missing_from_publication/expect.json +17 -0
  181. pg_cdc_doctor-0.1.0/tests/scenarios/cdc063_table_missing_from_publication/setup.sql +4 -0
  182. pg_cdc_doctor-0.1.0/tests/scenarios/cdc064_slot_active/connector.json +18 -0
  183. pg_cdc_doctor-0.1.0/tests/scenarios/cdc064_slot_active/expect.json +30 -0
  184. pg_cdc_doctor-0.1.0/tests/scenarios/cdc064_slot_active/setup.sql +6 -0
  185. pg_cdc_doctor-0.1.0/tests/scenarios/cdc064_slot_wrong_plugin/connector.json +18 -0
  186. pg_cdc_doctor-0.1.0/tests/scenarios/cdc064_slot_wrong_plugin/expect.json +17 -0
  187. pg_cdc_doctor-0.1.0/tests/scenarios/cdc064_slot_wrong_plugin/setup.sql +5 -0
  188. pg_cdc_doctor-0.1.0/tests/scenarios/cdc065_failover_not_requested/connector.json +18 -0
  189. pg_cdc_doctor-0.1.0/tests/scenarios/cdc065_failover_not_requested/expect.json +18 -0
  190. pg_cdc_doctor-0.1.0/tests/scenarios/cdc065_failover_not_requested/setup.sql +6 -0
  191. pg_cdc_doctor-0.1.0/tests/scenarios/cdc065_failover_on_old_server/connector.json +19 -0
  192. pg_cdc_doctor-0.1.0/tests/scenarios/cdc065_failover_on_old_server/expect.json +17 -0
  193. pg_cdc_doctor-0.1.0/tests/scenarios/cdc065_failover_on_old_server/setup.sql +4 -0
  194. pg_cdc_doctor-0.1.0/tests/scenarios/cdc065_slot_exists_without_failover/connector.json +19 -0
  195. pg_cdc_doctor-0.1.0/tests/scenarios/cdc065_slot_exists_without_failover/expect.json +24 -0
  196. pg_cdc_doctor-0.1.0/tests/scenarios/cdc065_slot_exists_without_failover/setup.sql +7 -0
  197. pg_cdc_doctor-0.1.0/tests/scenarios/cdc066_no_heartbeat/connector.properties +13 -0
  198. pg_cdc_doctor-0.1.0/tests/scenarios/cdc066_no_heartbeat/expect.json +16 -0
  199. pg_cdc_doctor-0.1.0/tests/scenarios/cdc066_no_heartbeat/setup.sql +4 -0
  200. pg_cdc_doctor-0.1.0/tests/scenarios/clean/expect.json +28 -0
  201. pg_cdc_doctor-0.1.0/tests/scenarios/clean/setup.sql +6 -0
  202. pg_cdc_doctor-0.1.0/tests/scenarios/clean_all_tables/expect.json +19 -0
  203. pg_cdc_doctor-0.1.0/tests/scenarios/clean_all_tables/setup.sql +6 -0
  204. pg_cdc_doctor-0.1.0/tests/scenarios/clean_debezium/connector.json +18 -0
  205. pg_cdc_doctor-0.1.0/tests/scenarios/clean_debezium/expect.json +24 -0
  206. pg_cdc_doctor-0.1.0/tests/scenarios/clean_debezium/setup.sql +5 -0
  207. pg_cdc_doctor-0.1.0/tests/scenarios/clean_failover/expect.json +42 -0
  208. pg_cdc_doctor-0.1.0/tests/scenarios/clean_failover/setup.sql +8 -0
  209. pg_cdc_doctor-0.1.0/tests/test_catalog.py +123 -0
  210. pg_cdc_doctor-0.1.0/tests/test_cli.py +109 -0
  211. pg_cdc_doctor-0.1.0/tests/test_connect.py +352 -0
  212. pg_cdc_doctor-0.1.0/tests/test_debezium.py +233 -0
  213. pg_cdc_doctor-0.1.0/tests/test_failover.py +289 -0
  214. pg_cdc_doctor-0.1.0/tests/test_options.py +189 -0
  215. pg_cdc_doctor-0.1.0/tests/test_pg.py +368 -0
  216. pg_cdc_doctor-0.1.0/tests/test_report.py +95 -0
  217. pg_cdc_doctor-0.1.0/tests/test_slots.py +61 -0
  218. pg_cdc_doctor-0.1.0/tests/test_util.py +94 -0
@@ -0,0 +1,9 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+ .DS_Store
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,4 @@
1
+ pg-cdc-doctor
2
+ Copyright 2026 Basant Bhattarai
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
@@ -0,0 +1,416 @@
1
+ Metadata-Version: 2.5
2
+ Name: pg-cdc-doctor
3
+ Version: 0.1.0
4
+ Summary: Read-only checker: is this PostgreSQL database ready for logical-replication CDC, and what will break.
5
+ Author: Basant Bhattarai
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ License-File: NOTICE
9
+ Keywords: cdc,debezium,logical-replication,pgoutput,postgresql,replication-slot
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Database
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: psycopg[binary]>=3.2
25
+ Description-Content-Type: text/markdown
26
+
27
+ # pg-cdc-doctor
28
+
29
+ pg-cdc-doctor connects to a PostgreSQL database with a read-only session and lists what will stop
30
+ a logical-replication CDC consumer (Debezium or any pgoutput client) from starting or keeping up:
31
+ server settings, the connecting role, replication slots, tables without a usable replica identity,
32
+ publication definitions, failover and standby settings (PostgreSQL 17 and later), and a Debezium
33
+ connector configuration compared with the database. Every finding has a stable ID (CDC001 to
34
+ CDC066), a severity, an explanation and a fix. It runs on PostgreSQL 13 to 18.
35
+
36
+ ## Install
37
+
38
+ ```sh
39
+ pip install pg-cdc-doctor
40
+ ```
41
+
42
+ or run it without installing:
43
+
44
+ ```sh
45
+ uvx pg-cdc-doctor check --help
46
+ ```
47
+
48
+ Python 3.10 or later. The only dependency is psycopg 3.
49
+
50
+ From a checkout: `uv sync`, then `uv run pg-cdc-doctor check --help`.
51
+
52
+ ## Quick start
53
+
54
+ ```sh
55
+ pg-cdc-doctor check --dsn "postgresql://user@host:5432/app" --publication cdc_pub --slot cdc_slot
56
+ ```
57
+
58
+ Without `--dsn` the libpq environment variables (`PGHOST`, `PGUSER`, `PGPASSWORD`, ...) are used.
59
+ The password is never printed; a DSN that appears in an error message is masked.
60
+
61
+ The two outputs below are real runs against PostgreSQL 17.12 in Docker, from the scenario databases
62
+ `clean` and `cdc030_no_pk_default` (see [The evidence](#the-evidence)). The first, run with
63
+ `--publication cdc_pub --slot cdc_slot` while a consumer streams from the slot, exits 0:
64
+
65
+ ```text
66
+ pg-cdc-doctor 0.1.0: PostgreSQL 17.12
67
+ target: postgres@127.0.0.1:57414/sc_clean
68
+ scope: tables of publication 'cdc_pub': 3 table(s)
69
+
70
+ Server
71
+ INFO CDC010 server_version PostgreSQL 17.12
72
+ ok CDC001 wal_level wal_level is logical
73
+ ok CDC002 max_replication_slots 9 free replication slots (1 of 10 in use)
74
+ ok CDC003 max_wal_senders 9 free WAL senders (1 of 10 in use)
75
+ ok CDC004 max_slot_wal_keep_size max_slot_wal_keep_size is bounded (5120 MB)
76
+ ok CDC005 wal_sender_timeout wal_sender_timeout is positive
77
+ ok CDC008 pg_prepared_xacts no prepared transactions
78
+ ok CDC009 pg_stat_activity no transaction with an ID open longer than 15 min
79
+
80
+ Role
81
+ ok CDC006 postgres role 'postgres' can replicate (superuser)
82
+ ok CDC007 3 tables role 'postgres' can SELECT from every captured table
83
+
84
+ Replication slots
85
+ ok CDC020 1 slots 1 logical slot(s), none inactive, lost or over the retention limit
86
+ ok CDC023 cdc_slot slot 'cdc_slot' exists and uses pgoutput
87
+
88
+ Tables
89
+ INFO CDC033 public.customers unchanged TOASTed values arrive without their value on UPDATE
90
+ fix: If consumers need the value on every update: ALTER TABLE public.customers REPLICA
91
+ IDENTITY FULL, or merge with the previous state downstream.
92
+ INFO CDC033 public.order_items unchanged TOASTed values arrive without their value on UPDATE
93
+ fix: If consumers need the value on every update: ALTER TABLE public.order_items REPLICA
94
+ IDENTITY FULL, or merge with the previous state downstream.
95
+ INFO CDC033 public.orders unchanged TOASTed values arrive without their value on UPDATE
96
+ fix: If consumers need the value on every update: ALTER TABLE public.orders REPLICA IDENTITY
97
+ FULL, or merge with the previous state downstream.
98
+ ok CDC030 3 tables every captured table has a usable replica identity
99
+ ok CDC034 3 tables no unlogged table in scope
100
+
101
+ summary: 0 fail, 0 warn, 4 info
102
+ ```
103
+
104
+ The second, run with `--publication p`, has a table without a primary key in a publication that
105
+ publishes updates. The tool exits 1:
106
+
107
+ ```text
108
+ pg-cdc-doctor 0.1.0: PostgreSQL 17.12
109
+ target: postgres@127.0.0.1:57414/sc_cdc030_no_pk_default
110
+ scope: tables of publication 'p': 2 table(s)
111
+
112
+ Server
113
+ INFO CDC010 server_version PostgreSQL 17.12
114
+ ok CDC001 wal_level wal_level is logical
115
+ ok CDC002 max_replication_slots 9 free replication slots (1 of 10 in use)
116
+ ok CDC003 max_wal_senders 9 free WAL senders (1 of 10 in use)
117
+ ok CDC004 max_slot_wal_keep_size max_slot_wal_keep_size is bounded (5120 MB)
118
+ ok CDC005 wal_sender_timeout wal_sender_timeout is positive
119
+ ok CDC008 pg_prepared_xacts no prepared transactions
120
+ ok CDC009 pg_stat_activity no transaction with an ID open longer than 15 min
121
+
122
+ Role
123
+ ok CDC006 postgres role 'postgres' can replicate (superuser)
124
+ ok CDC007 2 tables role 'postgres' can SELECT from every captured table
125
+
126
+ Replication slots
127
+ ok CDC020 1 slots 1 logical slot(s), none inactive, lost or over the retention limit
128
+
129
+ Tables
130
+ FAIL CDC030 public.no_pk no primary key and replica identity DEFAULT: UPDATE and DELETE will fail once published
131
+ fix: Add a primary key, or ALTER TABLE public.no_pk REPLICA IDENTITY USING INDEX <unique
132
+ not-null index>, or as a last resort ALTER TABLE public.no_pk REPLICA IDENTITY FULL.
133
+ INFO CDC033 public.no_pk unchanged TOASTed values arrive without their value on UPDATE
134
+ fix: If consumers need the value on every update: ALTER TABLE public.no_pk REPLICA IDENTITY
135
+ FULL, or merge with the previous state downstream.
136
+ INFO CDC033 public.with_pk unchanged TOASTed values arrive without their value on UPDATE
137
+ fix: If consumers need the value on every update: ALTER TABLE public.with_pk REPLICA
138
+ IDENTITY FULL, or merge with the previous state downstream.
139
+ ok CDC034 2 tables no unlogged table in scope
140
+
141
+ summary: 1 fail, 0 warn, 3 info
142
+ ```
143
+
144
+ `-v` adds the detail of each finding. Findings with severity `ok` are shown so a clean report shows
145
+ what was checked.
146
+
147
+ ### With a standby
148
+
149
+ ```sh
150
+ pg-cdc-doctor check --dsn "postgresql://user@primary/app" \
151
+ --standby-dsn "postgresql://user@standby/app" \
152
+ --publication cdc_pub --slot cdc_slot
153
+ ```
154
+
155
+ `--standby-dsn` adds the slot-synchronization checks CDC055 to CDC059. The standby must be in
156
+ recovery, run PostgreSQL 17 or later and have the same system identifier as the primary, otherwise
157
+ the exit code is 2. Without it, CDC051 to CDC053 still read the primary's side of failover.
158
+
159
+ ### With a Debezium connector file
160
+
161
+ ```sh
162
+ pg-cdc-doctor check --dsn "postgresql://user@host:5432/app" --debezium connector.json
163
+ ```
164
+
165
+ `--debezium` takes the Kafka Connect JSON (`{"name": ..., "config": {...}}`), a flat JSON object or a
166
+ `.properties` file. The connector decides the scope: its `table.include.list`,
167
+ `table.exclude.list` and schema filters pick the tables, its `publication.name` (default
168
+ `dbz_publication`) the publication and its `slot.name` (default `debezium`) the slot.
169
+ `--tables` cannot be combined with `--debezium`, and `--publication` or `--slot` are accepted only
170
+ when they equal the file's value; otherwise the exit code is 2. `database.password` and every key
171
+ containing `password` or `secret` are never printed.
172
+
173
+ With this file, whose passwords are placeholders:
174
+
175
+ ```json
176
+ {
177
+ "name": "app-connector",
178
+ "config": {
179
+ "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
180
+ "plugin.name": "pgoutput",
181
+ "database.hostname": "db.internal.example",
182
+ "database.port": "5432",
183
+ "database.user": "postgres",
184
+ "database.password": "change-me",
185
+ "database.dbname": "app",
186
+ "topic.prefix": "app",
187
+ "slot.name": "dbz_slot",
188
+ "publication.name": "dbz_pub",
189
+ "publication.autocreate.mode": "disabled",
190
+ "table.include.list": "public\\.(customers|orders)",
191
+ "heartbeat.interval.ms": "10000"
192
+ }
193
+ }
194
+ ```
195
+
196
+ against a database where `public.orders` is not in the publication, the Debezium section reads as
197
+ follows (the Server, Role, Replication slots and Tables sections of the same report are left out
198
+ here):
199
+
200
+ ```text
201
+ pg-cdc-doctor 0.1.0: PostgreSQL 17.12
202
+ target: postgres@127.0.0.1:57414/app
203
+ scope: tables captured by connector.json (Debezium schema and table filters): 2 table(s)
204
+
205
+ (Server, Role, Replication slots and Tables sections omitted)
206
+
207
+ Debezium config
208
+ FAIL CDC063 public.orders public.orders matches the connector filters but is not in publication 'dbz_pub'
209
+ fix: ALTER PUBLICATION dbz_pub ADD TABLE public.orders;
210
+ INFO CDC063 dbz_pub 1 table(s) in 'dbz_pub' are excluded by the connector filters
211
+ ok CDC060 plugin.name plugin.name is pgoutput
212
+ ok CDC061 database.dbname database.dbname is 'app'
213
+ ok CDC062 dbz_pub publication 'dbz_pub' exists; autocreate is disabled, so it is used as is
214
+ ok CDC064 dbz_slot slot 'dbz_slot' does not exist yet; the connector creates it with plugin pgoutput
215
+ ok CDC065 slot.failover slot.failover is not set and no standby exists
216
+ ok CDC066 heartbeat.interval.ms heartbeat every 10000 ms
217
+
218
+ summary: 1 fail, 0 warn, 4 info
219
+ ```
220
+
221
+ ## What it checks
222
+
223
+ 42 checks. The full text of each (what it means, why it matters for CDC, the fix, the versions,
224
+ the documentation it rests on) is in [docs/checks.md](docs/checks.md), which is generated from the
225
+ catalog in `src/pg_cdc_doctor/checks/catalog.py`.
226
+
227
+ | ID | Area | Finding | PostgreSQL |
228
+ |---|---|---|---|
229
+ | CDC001 | Server | wal_level is not logical | 13-18 |
230
+ | CDC002 | Server | no free replication slots | 13-18 |
231
+ | CDC003 | Server | no free WAL sender processes | 13-18 |
232
+ | CDC004 | Server | max_slot_wal_keep_size is unbounded | 13-18 |
233
+ | CDC005 | Server | wal_sender_timeout is 0 | 13-18 |
234
+ | CDC006 | Role | connecting role cannot replicate | 13-18 |
235
+ | CDC007 | Role | role lacks SELECT on a captured table | 13-18 |
236
+ | CDC008 | Server | prepared transactions exist | 13-18 |
237
+ | CDC009 | Server | long-running transactions | 13-18 |
238
+ | CDC010 | Server | server version | 13-18 |
239
+ | CDC020 | Replication slots | slot WAL status | 13-18 |
240
+ | CDC021 | Replication slots | inactive logical slot | 13-18 |
241
+ | CDC022 | Replication slots | slot retains more WAL than the limit | 13-18 |
242
+ | CDC023 | Replication slots | named slot | 13-18 |
243
+ | CDC030 | Tables | no primary key and replica identity DEFAULT | 13-18 |
244
+ | CDC031 | Tables | replica identity NOTHING, or USING INDEX with the index gone | 13-18 |
245
+ | CDC032 | Tables | replica identity FULL | 13-18 |
246
+ | CDC033 | Tables | TOASTed values omitted on UPDATE | 13-18 |
247
+ | CDC034 | Tables | unlogged table | 13-18 |
248
+ | CDC035 | Tables | partitioned table published by leaf partition | 13-18 |
249
+ | CDC040 | Publication | publication does not exist | 13-18 |
250
+ | CDC041 | Publication | publication does not publish an action | 13-18 |
251
+ | CDC042 | Publication | column list does not cover the replica identity | 15-18 |
252
+ | CDC043 | Publication | row filter uses a column outside the replica identity | 15-18 |
253
+ | CDC044 | Publication | listed table is not in the publication | 13-18 |
254
+ | CDC045 | Tables | generated columns | 13-18 (publish_generated_columns: 18) |
255
+ | CDC050 | Failover and standby | logical slots are not carried to a standby before PostgreSQL 17 | 13-16 |
256
+ | CDC051 | Failover and standby | logical slot is not failover-enabled but a standby exists | 17-18 |
257
+ | CDC052 | Failover and standby | failover slots exist but synchronized_standby_slots is empty | 17-18 |
258
+ | CDC053 | Failover and standby | synchronized_standby_slots names a slot that cannot confirm WAL | 17-18 |
259
+ | CDC055 | Failover and standby | sync_replication_slots is off on the standby | 17-18 |
260
+ | CDC056 | Failover and standby | hot_standby_feedback is off on the standby | 17-18 |
261
+ | CDC057 | Failover and standby | primary_slot_name is empty on the standby | 17-18 |
262
+ | CDC058 | Failover and standby | primary_conninfo has no dbname on the standby | 17-18 |
263
+ | CDC059 | Failover and standby | failover slot is not ready to promote | 17-18 |
264
+ | CDC060 | Debezium config | plugin.name is not pgoutput | 13-18 |
265
+ | CDC061 | Debezium config | database.dbname differs from the connected database | 13-18 |
266
+ | CDC062 | Debezium config | publication prerequisites of publication.autocreate.mode are not met | 13-18 |
267
+ | CDC063 | Debezium config | captured tables versus the publication | 13-18 |
268
+ | CDC064 | Debezium config | the connector's slot exists with another plugin (fail), or is in use (warn) | 13-18 |
269
+ | CDC065 | Debezium config | slot.failover does not match the server | 13-18 (failover slots: 17) |
270
+ | CDC066 | Debezium config | no heartbeat | 13-18 |
271
+
272
+ Debezium checks follow the property names and defaults of the Debezium 3.7 PostgreSQL connector
273
+ documentation.
274
+
275
+ ## Read-only guarantee
276
+
277
+ The tool sends only `SELECT` and `SHOW`. Two mechanisms enforce it, and a test checks the result:
278
+
279
+ 1. The session is opened with `default_transaction_read_only = on`, so the server refuses data and
280
+ schema writes with SQLSTATE `25006`. It also sets `statement_timeout` and `lock_timeout`
281
+ (default 10 s, `--statement-timeout`) and `application_name = pg-cdc-doctor`.
282
+ 2. Every statement goes through a guard. It accepts one `SELECT` or `SHOW`, refuses a semicolon,
283
+ and then checks every `name(` in the text against an allowlist of the functions and SQL
284
+ keywords the tool's own queries use (`pg_catalog.` is the only qualifier allowed). A function
285
+ that is not on the list is refused, whether or not anyone knows it to be dangerous, so a new
286
+ server function, an extension function or a user-defined function cannot get through. Things
287
+ that could hide a call from that scan are refused too: comments, a double-quoted name followed
288
+ by `(`, dollar quoting, `U&"..."` and `E'...'`. A longer deny-list (slot creation and removal,
289
+ `pg_reload_conf`, `pg_switch_wal`, `set_config`, `nextval`, advisory locks, `query_to_xml`,
290
+ large-object writes, `pg_terminate_backend`, and others) stays as a second layer.
291
+
292
+ A test runs the whole tool against a database, with `--publication`, `--slot`, `--tables` and
293
+ `--debezium` (a connector file), and on 17 and 18 also with `--standby-dsn` against a live standby.
294
+ Before and after, it compares the per-table write counters (`pg_stat_user_tables`), the slot list
295
+ including each slot's `restart_lsn`, `confirmed_flush_lsn` and `wal_status`, the walsender
296
+ connections in `pg_stat_replication`, the publications and their tables, and the entries in
297
+ `postgresql.auto.conf`; with a standby it also compares the standby's slots.
298
+
299
+ Mechanism 1 alone is not enough, and the gap is measured. On PostgreSQL 13, 14, 15, 16, 17 and 18
300
+ (`tests/test_pg.py`, run on each version):
301
+
302
+ | Statement in a session with `default_transaction_read_only = on` | Result |
303
+ |---|---|
304
+ | `INSERT`, `UPDATE`, `DELETE`, `TRUNCATE` | refused, SQLSTATE 25006 |
305
+ | `CREATE TABLE`, `DROP TABLE`, `CREATE ROLE`, `CREATE PUBLICATION`, `CREATE TABLE AS`, `SELECT INTO` | refused, SQLSTATE 25006 |
306
+ | `SELECT ... FOR UPDATE`, `COMMENT ON`, `GRANT` | refused, SQLSTATE 25006 |
307
+ | `SELECT pg_create_logical_replication_slot(...)` | succeeds |
308
+ | `ALTER SYSTEM SET ...` | succeeds |
309
+
310
+ A read-only session therefore does not stop a slot from being created or the server configuration
311
+ from being rewritten. That is why mechanism 2 exists, and why the tool does not send either
312
+ statement. A test confirms that the guard refuses both before they reach the server.
313
+
314
+ The role you connect with decides what the tool can see. It needs `SELECT` on the captured tables
315
+ (CDC007). Without `pg_read_all_stats` or superuser, other sessions' transactions are hidden in
316
+ `pg_stat_activity`: CDC009 still warns about the long transactions it can see (those of the same
317
+ role or of roles it is a member of) and adds an `info` finding that it could not look at the rest.
318
+
319
+ ## The evidence
320
+
321
+ Every check has at least one scenario in `tests/scenarios/`: a `setup.sql` that builds the broken
322
+ (or correct) state, and an `expect.json` that says which findings must appear, with what severity,
323
+ and sometimes what the database really does. For the replica-identity checks the harness runs the
324
+ `UPDATE` and `DELETE` and asserts the server's error text; for the slot checks it asserts the slot
325
+ state it produced; for CDC053 it asserts the WAL sender's wait event. The failover scenarios start
326
+ a primary and a streaming standby (`pg_basebackup -R`) in Docker.
327
+
328
+ `results/matrix.md` is the result of running all scenarios on PostgreSQL 13.23, 14.24, 15.19,
329
+ 16.15, 17.12 and 18.7 (`uv run python scripts/matrix.py`, needs Docker):
330
+
331
+ | PostgreSQL | Server | Pass | Fail | Error | n/a |
332
+ |---|---|---|---|---|---|
333
+ | 13 | 13.23 | 55 | 0 | 0 | 23 |
334
+ | 14 | 14.24 | 55 | 0 | 0 | 23 |
335
+ | 15 | 15.19 | 60 | 0 | 0 | 18 |
336
+ | 16 | 16.15 | 60 | 0 | 0 | 18 |
337
+ | 17 | 17.12 | 71 | 0 | 0 | 7 |
338
+ | 18 | 18.7 | 75 | 0 | 0 | 3 |
339
+
340
+ Each version ran 78 scenarios; the counts are scenarios, not checks.
341
+
342
+ `n/a` means the scenario does not apply to that version: column lists and row filters exist from
343
+ 15, failover slots from 17, and CDC050 is about servers older than 17. Four scenarios (`clean`,
344
+ `clean_all_tables`, `clean_debezium`, `clean_failover`) are negative controls: each must produce no
345
+ `fail` and no `warn` wherever it runs.
346
+
347
+ ## Exit codes
348
+
349
+ | Code | Meaning |
350
+ |---|---|
351
+ | 0 | No finding at or above `--fail-on` (default `fail`; `warn` also fails on warnings) |
352
+ | 1 | At least one finding at or above `--fail-on` |
353
+ | 2 | The tool could not run: bad arguments, connection failure, an unreadable or invalid `--debezium` file, `--tables` combined with `--debezium`, `--publication` or `--slot` that differs from the connector file, a `--standby-dsn` that is not a standby, older than 17, or of another cluster |
354
+
355
+ ## JSON output
356
+
357
+ `--format json` prints one object with the keys `version`, `server_version`, `scope`, `findings` and
358
+ `summary`. Findings are ordered by area, then severity, then ID. The report never contains a
359
+ connection string or a password. One finding from the run above:
360
+
361
+ ```json
362
+ {
363
+ "id": "CDC030",
364
+ "severity": "fail",
365
+ "area": "tables",
366
+ "subject": "public.no_pk",
367
+ "title": "no primary key and replica identity DEFAULT: UPDATE and DELETE will fail once published",
368
+ "detail": "public.no_pk has no primary key and its replica identity is DEFAULT, so once the table is in a publication that publishes updates or deletes, UPDATE and DELETE on it fail in the application with: cannot update table \"no_pk\" because it does not have a replica identity and publishes updates, and cannot delete from table \"no_pk\" because it does not have a replica identity and publishes deletes. INSERT keeps working. This breaks the product's writes, not only CDC.",
369
+ "fix": "Add a primary key, or ALTER TABLE public.no_pk REPLICA IDENTITY USING INDEX <unique not-null index>, or as a last resort ALTER TABLE public.no_pk REPLICA IDENTITY FULL.",
370
+ "docs_url": "https://www.postgresql.org/docs/17/logical-replication-publication.html"
371
+ }
372
+ ```
373
+
374
+ and its `summary` is `{"fail": 1, "warn": 0, "info": 3}`. Each finding has `id`, `severity`
375
+ (`fail`, `warn`, `info` or `ok`), `area`, `subject`, `title`, `detail`, `fix` and `docs_url`.
376
+
377
+ ## Limits
378
+
379
+ - No run has been made against a managed service (RDS, Aurora, Cloud SQL, Azure Database for
380
+ PostgreSQL or others). Managed-service detection (CDC001 and the role check CDC006) looks for
381
+ markers such as the role `rds_superuser` or `rds_replication` and the settings `rds.extensions`,
382
+ `cloudsql.logical_decoding` and `azure.extensions`. The scenarios imitate those markers with
383
+ roles and settings created on a plain PostgreSQL server, so the detection is simulated, and the
384
+ parameter names in the fix text come from vendor documentation that was not exercised.
385
+ - Plain `postgres:<major>` Docker images only: no extensions beyond the bundled ones, and no
386
+ Patroni, pgBackRest or connection pooler in front of the server.
387
+ - CDC050 rests on the PostgreSQL 17 release notes ("Enable the failover of logical slots"), because
388
+ the 13 to 16 documentation has no sentence that says logical slots are not carried to a standby.
389
+ - Debezium table filters are evaluated with Python's `re`, which approximates the Java regular
390
+ expressions Debezium uses. An unusual pattern could match differently.
391
+ - The tool reads a point in time. A transaction that opens after the check, or a slot that stops
392
+ being consumed, is not seen until the next run.
393
+ - The tool does not read WAL, tables' contents or the connector's offsets, and it does not look at
394
+ the downstream (Kafka, the sink).
395
+
396
+ ## Related tools
397
+
398
+ Two other tools check part of the same ground, each as part of a larger product:
399
+
400
+ - [AWS DMS premigration assessments for PostgreSQL](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.AssessmentReport.PG.html)
401
+ run for a DMS migration task. Several read the same source settings as this tool (`wal_level`,
402
+ `max_wal_senders`, `max_slot_wal_keep_size`, `wal_sender_timeout`, free replication slots,
403
+ prepared and long-running transactions, tables without a primary key); many others are about DMS
404
+ itself (LOB modes, batch apply, the target database, data masking).
405
+ - [burnside-project/pg-cdc](https://github.com/burnside-project/pg-cdc) is a CDC server that writes
406
+ PostgreSQL changes to Parquet files. Its `pg-cdc preflight` command checks `wal_level`, the
407
+ replication privilege, CREATE on the database, slot headroom and replica identity, with
408
+ remediation for RDS and Aurora.
409
+
410
+ pg-cdc-doctor is not tied to a pipeline. It reads the database without changing it, runs on
411
+ PostgreSQL 13 to 18, checks failover readiness on a primary and a standby (17 and later), and
412
+ compares a Debezium connector file with the live database.
413
+
414
+ ## License
415
+
416
+ Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).