7

ERROR: no partition of relation "test_table" found for row DETAIL: Partition key of the failing row contains (start_time) = (2021-04-25 00:00:00). SQL state: 23514

I am inserting a data where i have a column start time (2021-04-25 00:00:00)

This is my Schema

CREATE TABLE test_table (
    start_time timestamp NULL,
)
PARTITION BY RANGE (start_time);

1 Answer 1

6

This sounds as if you have no partition-tables defined for this table. You might need something like this:

CREATE TABLE test_table_2021 PARTITION OF test_table
    FOR VALUES FROM ('2021-01-01') TO ('2022-01-01');

After you defined this partition for your partitioned table, you should be able to insert the data (as long as start_time is anywhen in 2021).

See the docs: https://www.postgresql.org/docs/current/ddl-partitioning.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.