Insert into partition table postgresql

Viewed 1015

everyone! I'm trying to insert data from non-partition table t1 to a partition one t2 with

insert into t2 (select * from t1);

But I get an error: Partition key of the falling row contains (column_name) = (value)

What can be wrong? t2 is partitioned by months by column date_name , not column_name

P.s. when I try to insert data from partition to partition table with the same way, I get the same error

Hoe should I insert data in partition table? Version: Postgresql 11

1 Answers

There must be at least one row in t1 for which there is no matching partition in t2. You have to create all partitions for the table before you insert data.

To figure out which row gives you trouble, look at the value from the error message.

Related