Skip to content

Partitions overlap when changing time zone of PostgreSQL #931

@bkhomuts

Description

@bkhomuts

Describe the bug
After moving to a different PostgreSQL server, the following error occurred on 1st of September.
postgresql log:

ERROR:  partition "dbname_y2025w36" would overlap partition "backends_dbname_y2025w35" at character 198
pgwatch@pgwatch_metrics QUERY:  CREATE  TABLE IF NOT EXISTS subpartitions."backends_dbname_y2025w36" PARTITION OF subpartitions."dbname" FOR VALUES FROM ('2025-09-01') TO ('2025-09-08')

pgwatch log:

ERROR: no partition of relation "dbname" found for row (SQLSTATE 23514)

To Reproduce
Steps to reproduce the behavior:

  1. At the end of the week, change timezone of the database from UTC to UTC+2.
  2. On the first day of the next week, check the logs of pgwatch and postgresql. The data won't be recorded.

Expected behavior
Partition would be created cleanly.

Additional context
System: Debian 13, using pgwatch from the apt.postgresql.org repository
PGWatch 3.7.0-2.pgdg130+3
PostgreSQL: 17.6-1.pgdg13+1
Changing timezone back to 'Etc/UTC' in postgresql.conf resolves the issue.

May be solved by checking for the end of last partition, and ensuring the new partition won't overlap when creating it. It is possible also to create a partition with a specific timezone during partition creation, but this may result in error for existing installations.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingsinksWhere and how to store monitored data

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions