I have an already existing table which I want to partition, looking at the documentation I see that this cannot happen, so I re-created the table and try to partition that:
CREATE TABLE tableB (LIKE tableA INCLUDING ALL) PARTITION BY range (field1_in_tableA, field2_in_tableA);
but I am getting:
ERROR: insufficient columns in PRIMARY KEY constraint definition DETAIL: PRIMARY KEY constraint on table "tableB" lacks column "field1_in_tableA" which is part of the partition key.
Is there any workaround to this?