I am using pg_partman on PostgreSQL DB, for creating auto partitioning for weekly data. The weeks are always created from Monday to Monday.
This is the query I am using:
SELECT partman.create_parent(p_parent_table => 'schema.table',
p_control => 'start_week_date',
p_type => 'native',
p_interval => 'weekly',
p_premake => 1);
This is the DDL generated by pg_partman:
partition of table
(
constraint table_p2021_09_pkey
primary key (id, start_week_date)
)
FOR VALUES FROM ('2021-10-25') TO ('2021-11-01');
I want the partition to be from Saturday to Saturday. Is it possible?
You may be able to get what you want by setting
p_start_partition
to be a Saturday. Seep_date_trunc_interval
in the documentation: