Time_bucket_gapfill to start on Sunday and not Monday with bucket_width='weekly

Hey everyone.
I use the time_bucket_gapfill function, with a weekly bucket width.
the output is always returned such that the week starts on monday.
For example - even when specifying these parameters:

time_bucket_gapfill(‘1 week’, my_table.date, ‘2024-05-22’, ‘2024-06-18’)

The output has dates of Mondays:

2024-05-20 2024-05-27 2024-06-03 2024-06-10 2024-06-17

I want to have the weeks start from Sunday rather than Monday. Couldn’t find anything useful in the documentation. Any advice?

Hi @Tal ,

Have you tried , to set the parameters start/finish?

  [,start TIMESTAMPTZ | INTEGER]
  [, finish TIMESTAMPTZ | INTEGER]

also, maybe have you look on what collations can do? I never tried but seems an option to build custom collation method to sort.

Hey, yes I used these parameters. this is the part of my query that make use of the time_bucket_gapfill:
time_bucket_gapfill(‘1 week’, my_table.date, ‘2024-05-22’, ‘2024-06-18’)
and the parameters are actually:
time_bucket_gapfill(bucket_width := ‘1 week’, ts := my_table.date, start:= ‘2024-05-22’, finish := ‘2024-06-18’).
But even though my start date is a Wednesday (22.5.24), the first record in the output is 20.5.24 (Monday).
Regarding the collation - not sure it’d be helpful in this case, this is more for sorting and comparing specific scenarios.