I was reading this article: https://blog.timescale.com/scaling-partitioning-data-postgresql-10-explained-cd48a712a9a1
the article lifts information directly from here: https://www.postgresql.org/docs/10/static/ddl-partitioning.html#DDL-PARTITIONING-DECLARATIVE
My question is - if we declaratively create a partitioned table like so:
CREATE TABLE measurement (
city_id int not null,
logdate date not null,
peaktemp int,
unitsales int
) PARTITION BY peaktemp;
and then let's say we insert into measurement
, but with a peaktemp
that is not covered by an existing partition.
Before we insert, do we need to manually create our own partition like so:
CREATE TABLE measurement_55 PARTITION OF measurement FOR VALUE 55;
..or will Postgres create that table for us if we insert into measurement
with peaktemp as 55?
Sorry the syntax might be wrong but hopefully the question makes sense. Basically I want to partition a table by an integer column, one partition for each value of the integer. And I am wondering what is automated and what remains manual in this case?
insert
throws an error. – a1ex07 Oct 24 '18 at 22:30