@@ -906,16 +906,16 @@ Indexes:
906
906
drop table idxpart;
907
907
-- Failing to use the full partition key is not allowed
908
908
create table idxpart (a int unique, b int) partition by range (a, b);
909
- ERROR:insufficient columns in UNIQUE constraint definition
909
+ ERROR:unique constraint on partitioned table must include all partitioning columns
910
910
DETAIL: UNIQUE constraint on table "idxpart" lacks column "b" which is part of the partition key.
911
911
create table idxpart (a int, b int unique) partition by range (a, b);
912
- ERROR:insufficient columns in UNIQUE constraint definition
912
+ ERROR:unique constraint on partitioned table must include all partitioning columns
913
913
DETAIL: UNIQUE constraint on table "idxpart" lacks column "a" which is part of the partition key.
914
914
create table idxpart (a int primary key, b int) partition by range (b, a);
915
- ERROR:insufficient columns in PRIMARY KEY constraint definition
915
+ ERROR:unique constraint on partitioned table must include all partitioning columns
916
916
DETAIL: PRIMARY KEY constraint on table "idxpart" lacks column "b" which is part of the partition key.
917
917
create table idxpart (a int, b int primary key) partition by range (b, a);
918
- ERROR:insufficient columns in PRIMARY KEY constraint definition
918
+ ERROR:unique constraint on partitioned table must include all partitioning columns
919
919
DETAIL: PRIMARY KEY constraint on table "idxpart" lacks column "a" which is part of the partition key.
920
920
-- OK if you use them in some other order
921
921
create table idxpart (a int, b int, c text, primary key (a, b, c)) partition by range (b, c, a);
@@ -935,7 +935,7 @@ DETAIL: UNIQUE constraints cannot be used when partition keys include expressio
935
935
-- use ALTER TABLE to add a primary key
936
936
create table idxpart (a int, b int, c text) partition by range (a, b);
937
937
alter table idxpart add primary key (a);-- not an incomplete one though
938
- ERROR:insufficient columns in PRIMARY KEY constraint definition
938
+ ERROR:unique constraint on partitioned table must include all partitioning columns
939
939
DETAIL: PRIMARY KEY constraint on table "idxpart" lacks column "b" which is part of the partition key.
940
940
alter table idxpart add primary key (a, b);-- this works
941
941
\d idxpart
@@ -966,7 +966,7 @@ drop table idxpart;
966
966
-- use ALTER TABLE to add a unique constraint
967
967
create table idxpart (a int, b int) partition by range (a, b);
968
968
alter table idxpart add unique (a);-- not an incomplete one though
969
- ERROR:insufficient columns in UNIQUE constraint definition
969
+ ERROR:unique constraint on partitioned table must include all partitioning columns
970
970
DETAIL: UNIQUE constraint on table "idxpart" lacks column "b" which is part of the partition key.
971
971
alter table idxpart add unique (b, a);-- this works
972
972
\d idxpart
@@ -1016,15 +1016,15 @@ drop table idxpart;
1016
1016
create table idxpart (a int, b int, primary key (a)) partition by range (a);
1017
1017
create table idxpart2 partition of idxpart
1018
1018
for values from (0) to (1000) partition by range (b); -- fail
1019
- ERROR:insufficient columns in PRIMARY KEY constraint definition
1019
+ ERROR:unique constraint on partitioned table must include all partitioning columns
1020
1020
DETAIL: PRIMARY KEY constraint on table "idxpart2" lacks column "b" which is part of the partition key.
1021
1021
drop table idxpart;
1022
1022
-- Ditto for the ATTACH PARTITION case
1023
1023
create table idxpart (a int unique, b int) partition by range (a);
1024
1024
create table idxpart1 (a int not null, b int, unique (a, b))
1025
1025
partition by range (a, b);
1026
1026
alter table idxpart attach partition idxpart1 for values from (1) to (1000);
1027
- ERROR:insufficient columns in UNIQUE constraint definition
1027
+ ERROR:unique constraint on partitioned table must include all partitioning columns
1028
1028
DETAIL: UNIQUE constraint on table "idxpart1" lacks column "b" which is part of the partition key.
1029
1029
DROP TABLE idxpart, idxpart1;
1030
1030
-- Multi-layer partitioning works correctly in this case:
@@ -1277,7 +1277,7 @@ insert into covidxpart values (4, 1);
1277
1277
ERROR: duplicate key value violates unique constraint "covidxpart4_a_b_idx"
1278
1278
DETAIL: Key (a)=(4) already exists.
1279
1279
create unique index on covidxpart (b) include (a); -- should fail
1280
- ERROR:insufficient columns in UNIQUE constraint definition
1280
+ ERROR:unique constraint on partitioned table must include all partitioning columns
1281
1281
DETAIL: UNIQUE constraint on table "covidxpart" lacks column "a" which is part of the partition key.
1282
1282
-- check that detaching a partition also detaches the primary key constraint
1283
1283
create table parted_pk_detach_test (a int primary key) partition by list (a);