Postgres 11
I want to make a table calendars, that is at the same time partitioned by range (one month of data) and a list of keys.
The reason is that:
- I want to prune months that are not longer updated.
- I need all the data to be partitioned by list of ids for further joins with and other partitioned table
listings, that is partitined by the same list of keys.
The documentation says:
Declarative partitioning only supports range, list and hash partitioning, whereas table inheritance allows data to be divided in a manner of the user's choosing.
Thus, if I get it right, this means that my taks can not be done with Declarative partitioning, but probably can be done using Inheritance.
So, I try to reproduce the given example with my modification
CREATE TABLE measurement (
city_id int not null,
logdate date not null,
peaktemp int,
unitsales int
) PARTITION BY RANGE (logdate); # this already does not accept mixed types of partitioning
than I try to create a partition with my mixed rules of partitining:
CREATE TABLE measurement_y2006m02 (
CHECK ( logdate >= DATE '2006-02-01' AND logdate < DATE '2006-03-01'
AND paektamp >0 AND peaktemp <=10)
) INHERITS (measurement);
this gives:
cannot inherit from partitioned table "measurement"
Thank you!