Skip to content

Commit c3590c2

Browse files
authored
[-] fix weekly partition naming at year boundaries (#974)
Extract both ISO year and week from the same date shifted by weeks only. This ensures correct partition names for all weeks, especially in December and January.
1 parent c66e693 commit c3590c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/sinks/sql/ensure_partition_postgres.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ BEGIN
6565
-- 3. level
6666
FOR i IN 0..partitions_to_precreate LOOP
6767

68-
l_year := extract(isoyear from (metric_timestamp + '1month'::interval * i));
68+
l_year := extract(isoyear from (metric_timestamp + '1week'::interval * i));
6969
l_week := extract(week from (metric_timestamp + '1week'::interval * i));
7070

7171
IF i = 0 THEN

0 commit comments

Comments
 (0)