You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Overlapping partitions caused by non-deterministic daily partitioning logic #262
The start() method in the PostgresTimePartitionSize class is currently non-deterministic when the unit is DAYS and value > 1. It simply returns the normalized date, without applying a fixed rule for grouping days into consistent, aligned partitions.
As a result, the same datetime value can be mapped to different partitions across different executions, depending on the runtime context. This leads to overlapping time intervals, which causes errors when creating physical partitions in PostgreSQL.
Real-world example
During the daily execution of the pgpartition maintenance job (triggered via cron), the following error occurred:
This error indicates that the system attempted to create a partition (2025_jun_04) with a time range that overlaps an existing partition (2025_jun_03), violating PostgreSQL's partitioning constraints.
Proposed Solution
Update the start() logic for DAYS to produce deterministic, consistent partition boundaries by anchoring the calculation to a fixed reference date (anchor_date) and aligning windows using integer division:
changed the title [-]Non-deterministic daily partitioning logic causes overlapping constraints during partition creation[/-][+]Overlapping partitions caused by non-deterministic daily partitioning logic[/+]on Jun 18, 2025
Activity
[-]Non-deterministic daily partitioning logic causes overlapping constraints during partition creation[/-][+]Overlapping partitions caused by non-deterministic daily partitioning logic[/+]