Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ws): fix datetime comparison crash in partitioned postgres sync (#57666)

estefania3ee0921d9a26
diff --git a/posthog/temporal/data_imports/sources/postgres/partitioned_tables.py b/posthog/temporal/data_imports/sources/postgres/partitioned_tables.py
index 924a40f7390a..8d2d0b64762a 100644
--- a/posthog/temporal/data_imports/sources/postgres/partitioned_tables.py
+++ b/posthog/temporal/data_imports/sources/postgres/partitioned_tables.py
@@ -550,6 +550,8 @@ def iterate_partitions(
# If range-partitioned on the incremental field, skip children whose upper
# bound is at or below cursor to avoid reading already-synced data.
skippable_upper: Any = db_incremental_field_last_value
+ if incremental_field_type is not None and skippable_upper is not None:
+ skippable_upper = _ensure_aware(skippable_upper, incremental_field_type)
partition_bounds: dict[str, tuple[Any, Any] | None] = {}
if incremental_field_type is not None and skippable_upper is not None:
for child in child_partitions: