|
|
|
|
@ -49,7 +49,7 @@ ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
(PARTITION sales_feb2022 FOR VALUES FROM ('2022-02-01') TO ('2022-10-01')); |
|
|
|
|
ERROR: list of new partitions should contain at least two partitions |
|
|
|
|
-- ERROR: lower bound of partition "sales_feb2022" is not equal to lower bound of split partition "sales_feb_mar_apr2022" |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
(PARTITION sales_feb2022 FOR VALUES FROM ('2022-01-01') TO ('2022-03-01'), |
|
|
|
|
PARTITION sales_mar2022 FOR VALUES FROM ('2022-03-01') TO ('2022-04-01'), |
|
|
|
|
@ -57,7 +57,7 @@ ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
ERROR: lower bound of partition "sales_feb2022" is not equal to lower bound of split partition "sales_feb_mar_apr2022" |
|
|
|
|
LINE 2: (PARTITION sales_feb2022 FOR VALUES FROM ('2022-01-01') TO... |
|
|
|
|
^ |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
-- ERROR: partition with name "sales_feb_mar_apr2022" is already used |
|
|
|
|
-- (We can create partition with the same name as split partition, but can't create two partitions with the same name) |
|
|
|
|
ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
@ -92,7 +92,7 @@ ALTER TABLE sales_feb_mar_apr2022 SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
ERROR: ALTER action SPLIT PARTITION cannot be performed on relation "sales_feb_mar_apr2022" |
|
|
|
|
DETAIL: This operation is not supported for tables. |
|
|
|
|
-- ERROR: upper bound of partition "sales_apr2022" is not equal to upper bound of split partition "sales_feb_mar_apr2022" |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
(PARTITION sales_feb2022 FOR VALUES FROM ('2022-02-01') TO ('2022-03-01'), |
|
|
|
|
PARTITION sales_mar2022 FOR VALUES FROM ('2022-03-01') TO ('2022-04-01'), |
|
|
|
|
@ -100,7 +100,7 @@ ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
ERROR: upper bound of partition "sales_apr2022" is not equal to upper bound of split partition "sales_feb_mar_apr2022" |
|
|
|
|
LINE 4: ... sales_apr2022 FOR VALUES FROM ('2022-04-01') TO ('2022-06-0... |
|
|
|
|
^ |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
-- ERROR: can not split to partition "sales_mar2022" together with partition "sales_feb2022" |
|
|
|
|
ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
(PARTITION sales_feb2022 FOR VALUES FROM ('2022-02-01') TO ('2022-03-01'), |
|
|
|
|
@ -114,7 +114,7 @@ HINT: ALTER TABLE ... SPLIT PARTITION requires the partition bounds to be adjac |
|
|
|
|
-- Tests for spaces between partitions, them should be executed without DEFAULT partition |
|
|
|
|
ALTER TABLE sales_range DETACH PARTITION sales_others; |
|
|
|
|
-- ERROR: lower bound of partition "sales_feb2022" is not equal to lower bound of split partition "sales_feb_mar_apr2022" |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
(PARTITION sales_feb2022 FOR VALUES FROM ('2022-02-02') TO ('2022-03-01'), |
|
|
|
|
PARTITION sales_mar2022 FOR VALUES FROM ('2022-03-01') TO ('2022-04-01'), |
|
|
|
|
@ -122,7 +122,7 @@ ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
ERROR: lower bound of partition "sales_feb2022" is not equal to lower bound of split partition "sales_feb_mar_apr2022" |
|
|
|
|
LINE 2: (PARTITION sales_feb2022 FOR VALUES FROM ('2022-02-02') TO... |
|
|
|
|
^ |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
-- Check the source partition not in the search path |
|
|
|
|
SET search_path = partition_split_schema2, public; |
|
|
|
|
ALTER TABLE partition_split_schema.sales_range |
|
|
|
|
@ -151,7 +151,7 @@ CREATE TABLE sales_range (sales_date date) PARTITION BY RANGE (sales_date); |
|
|
|
|
CREATE TABLE sales_jan2022 PARTITION OF sales_range FOR VALUES FROM ('2022-01-01') TO ('2022-02-01'); |
|
|
|
|
CREATE TABLE sales_feb_mar_apr2022 PARTITION OF sales_range FOR VALUES FROM ('2022-02-01') TO ('2022-05-01'); |
|
|
|
|
-- ERROR: upper bound of partition "sales_apr2022" is not equal to upper bound of split partition "sales_feb_mar_apr2022" |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
(PARTITION sales_feb2022 FOR VALUES FROM ('2022-02-01') TO ('2022-03-01'), |
|
|
|
|
PARTITION sales_mar2022 FOR VALUES FROM ('2022-03-01') TO ('2022-04-01'), |
|
|
|
|
@ -159,7 +159,7 @@ ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO |
|
|
|
|
ERROR: upper bound of partition "sales_apr2022" is not equal to upper bound of split partition "sales_feb_mar_apr2022" |
|
|
|
|
LINE 4: ... sales_apr2022 FOR VALUES FROM ('2022-04-01') TO ('2022-06-0... |
|
|
|
|
^ |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
DROP TABLE sales_range; |
|
|
|
|
-- |
|
|
|
|
-- Add rows into partitioned table then split partition |
|
|
|
|
@ -509,7 +509,7 @@ LINE 3: PARTITION sales_error FOR VALUES FROM ('2021-12-01') TO (... |
|
|
|
|
DETAIL: lower bound of partition "sales_error" is not equal to the upper bound of partition "sales_dec2021" |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION requires the partition bounds to be adjacent. |
|
|
|
|
-- ERROR: can not split DEFAULT partition "sales_others" |
|
|
|
|
-- HINT: To split DEFAULT partition one of the new partition msut be DEFAULT |
|
|
|
|
-- HINT: To split DEFAULT partition one of the new partition must be DEFAULT. |
|
|
|
|
ALTER TABLE sales_range SPLIT PARTITION sales_others INTO |
|
|
|
|
(PARTITION sales_dec2021 FOR VALUES FROM ('2021-12-01') TO ('2022-01-01'), |
|
|
|
|
PARTITION sales_jan2022 FOR VALUES FROM ('2022-01-01') TO ('2022-02-01'), |
|
|
|
|
@ -517,7 +517,7 @@ ALTER TABLE sales_range SPLIT PARTITION sales_others INTO |
|
|
|
|
ERROR: can not split DEFAULT partition "sales_others" |
|
|
|
|
LINE 2: (PARTITION sales_dec2021 FOR VALUES FROM ('2021-12-01') TO... |
|
|
|
|
^ |
|
|
|
|
HINT: To split DEFAULT partition one of the new partition msut be DEFAULT |
|
|
|
|
HINT: To split DEFAULT partition one of the new partition must be DEFAULT. |
|
|
|
|
-- no error: bounds of sales_noerror are between sales_dec2021 and sales_feb2022 |
|
|
|
|
ALTER TABLE sales_range SPLIT PARTITION sales_others INTO |
|
|
|
|
(PARTITION sales_dec2021 FOR VALUES FROM ('2021-12-01') TO ('2022-01-01'), |
|
|
|
|
@ -919,21 +919,21 @@ CREATE TABLE sales_list(sales_state VARCHAR(20)) PARTITION BY LIST (sales_state) |
|
|
|
|
CREATE TABLE sales_nord PARTITION OF sales_list FOR VALUES IN ('Helsinki', 'St. Petersburg', 'Oslo'); |
|
|
|
|
CREATE TABLE sales_all PARTITION OF sales_list FOR VALUES IN ('Warsaw', 'Lisbon', 'New York', 'Madrid', 'Beijing', 'Berlin', 'Delhi', 'Kyiv', 'Vladivostok', NULL); |
|
|
|
|
-- ERROR: new partitions combined partition bounds do not contain value (NULL) but split partition "sales_all" does |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
ALTER TABLE sales_list SPLIT PARTITION sales_all INTO |
|
|
|
|
(PARTITION sales_west FOR VALUES IN ('Lisbon', 'New York', 'Madrid'), |
|
|
|
|
PARTITION sales_east FOR VALUES IN ('Beijing', 'Delhi', 'Vladivostok'), |
|
|
|
|
PARTITION sales_central FOR VALUES IN ('Warsaw', 'Berlin', 'Kyiv')); |
|
|
|
|
ERROR: new partitions combined partition bounds do not contain value (NULL) but split partition "sales_all" does |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
-- ERROR: new partitions combined partition bounds do not contain value ('Kyiv'::character varying(20)) but split partition "sales_all" does |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
-- HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
ALTER TABLE sales_list SPLIT PARTITION sales_all INTO |
|
|
|
|
(PARTITION sales_west FOR VALUES IN ('Lisbon', 'New York', 'Madrid'), |
|
|
|
|
PARTITION sales_east FOR VALUES IN ('Beijing', 'Delhi', 'Vladivostok'), |
|
|
|
|
PARTITION sales_central FOR VALUES IN ('Warsaw', 'Berlin', NULL)); |
|
|
|
|
ERROR: new partitions combined partition bounds do not contain value ('Kyiv'::character varying(20)) but split partition "sales_all" does |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION require combined bounds of new partitions must exactly match the bound of the split partition. |
|
|
|
|
-- ERROR DEFAULT partition should be one |
|
|
|
|
ALTER TABLE sales_list SPLIT PARTITION sales_all INTO |
|
|
|
|
(PARTITION sales_west FOR VALUES IN ('Lisbon', 'New York', 'Madrid'), |
|
|
|
|
@ -1207,7 +1207,7 @@ ALTER TABLE t2 SPLIT PARTITION t1pa INTO |
|
|
|
|
(PARTITION t2a FOR VALUES FROM ('A') TO ('B'), |
|
|
|
|
PARTITION t2b FOR VALUES FROM ('B') TO ('C')); |
|
|
|
|
ERROR: relation "t1pa" is not a partition of relation "t2" |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION can only split partitions don't have sub-partitions |
|
|
|
|
HINT: ALTER TABLE ... SPLIT PARTITION can only split partitions don't have sub-partitions. |
|
|
|
|
DROP TABLE t2; |
|
|
|
|
DROP TABLE t1; |
|
|
|
|
-- |
|
|
|
|
|