添加分区表操作提示信息

This commit is contained in:
wangpingyun
2024-04-17 10:55:56 +08:00
parent 491925f147
commit c23dc684b2
41 changed files with 282 additions and 0 deletions

View File

@ -24632,6 +24632,8 @@ static void ATUnusableGlobalIndex(Relation rel)
CacheInvalidateRelcache(rel);
CommandCounterIncrement();
}
ereport(NOTICE, (errmsg("Command without UPDATE GLOBAL INDEX will disable global index")));
}
/*

View File

@ -356,6 +356,7 @@ order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
(30 rows)
ALTER TABLE alter_table drop partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select part.relname, part.indextblid, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible,
part.reltoastrelid, part.partkey, part.interval, part.boundaries, part.reltuples
from pg_class class, pg_partition part, pg_index ind where class.relname = 'alter_table' and ind.indrelid = class.oid and part.parentid = ind.indrelid
@ -535,6 +536,7 @@ order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
(27 rows)
ALTER TABLE alter_table TRUNCATE partition p2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select part.relname, part.indextblid, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible,
part.reltoastrelid, part.partkey, part.interval, part.boundaries, part.reltuples
from pg_class class, pg_partition part, pg_index ind where class.relname = 'alter_table' and ind.indrelid = class.oid and part.parentid = ind.indrelid
@ -714,6 +716,7 @@ order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
(27 rows)
ALTER TABLE alter_table SPLIT PARTITION p0 AT (2500) INTO (PARTITION p10, PARTITION p11);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select part.relname, part.indextblid, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible,
part.reltoastrelid, part.partkey, part.interval, part.boundaries, part.reltuples
from pg_class class, pg_partition part, pg_index ind where class.relname = 'alter_table' and ind.indrelid = class.oid and part.parentid = ind.indrelid
@ -899,6 +902,7 @@ order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
(30 rows)
ALTER TABLE alter_table MERGE PARTITIONS p10, p11 INTO PARTITION p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select part.relname, part.indextblid, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible,
part.reltoastrelid, part.partkey, part.interval, part.boundaries, part.reltuples
from pg_class class, pg_partition part, pg_index ind where class.relname = 'alter_table' and ind.indrelid = class.oid and part.parentid = ind.indrelid
@ -1089,6 +1093,7 @@ order by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11;
(27 rows)
ALTER TABLE alter_table EXCHANGE PARTITION FOR(2500) WITH TABLE exchange_table;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select part.relname, part.indextblid, part.parttype, part.rangenum, part.intervalnum, part.partstrategy, part.relallvisible,
part.reltoastrelid, part.partkey, part.interval, part.boundaries, part.reltuples
from pg_class class, pg_partition part, pg_index ind where class.relname = 'alter_table' and ind.indrelid = class.oid and part.parentid = ind.indrelid

View File

@ -426,6 +426,7 @@ start transaction;
alter table test_gpi_more_invalid add partition p5 values less than (4001);
update test_gpi_more_invalid set a = a + 1000 where a > 1000 or a < 500;
alter table test_gpi_more_invalid drop partition p5;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
commit;
-- all global index unusuable
select c.relname, i.indisusable from pg_index i join pg_class c on i.indexrelid = c.oid where i.indrelid = 'test_gpi_more_invalid'::regclass ORDER BY c.relname;
@ -530,6 +531,7 @@ select a.relname,a.parttype,a.reloptions from pg_partition a, pg_class b where a
(2 rows)
alter table interval_normal_date drop partition sys_p2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
commit;
select a.relname,a.parttype,a.reloptions from pg_partition a, pg_class b where a.parentid = b.oid and b.relname = 'interval_normal_date' and a.reloptions[3] like '%wait_clean_gpi=y%' order by 1,2,3;
relname | parttype | reloptions

View File

@ -178,6 +178,7 @@ select a.relname,a.parttype,a.reloptions from pg_partition a, pg_class b where
(1 row)
alter table gpi_test_invalid_part drop partition p9;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--p9 not exists
select a.relname,a.parttype,a.reloptions from pg_partition a, pg_class b where a.parttype = 'p' and a.relname = 'p9' and a.reloptions[3] like '%wait_clean_gpi=y%' and b.relname = 'gpi_test_invalid_part' order by 1,2,3;
relname | parttype | reloptions
@ -268,6 +269,7 @@ select a.relname,a.parttype,a.reloptions from pg_partition a, pg_class b where a
(1 row)
alter table gpi_test_invalid_part drop partition p9;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--p9 not exists
select a.relname,a.parttype,a.reloptions from pg_partition a, pg_class b where a.parttype = 'p' and a.relname = 'p9' and a.reloptions[3] like '%wait_clean_gpi=y%' and b.relname = 'gpi_test_invalid_part' order by 1,2,3;
relname | parttype | reloptions

View File

@ -7,8 +7,10 @@ partition create_columnar_table_partition_p5 values less than(4121),
partition create_columnar_table_partition_p6 values less than(maxvalue)) ;
create index create_columnar_index_1_106 on create_columnar_table_106(c_integer,c_numeric,c_text,c_timestamp_with_timezone) local;
alter table create_columnar_table_106 truncate partition create_columnar_table_partition_p6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
insert into create_columnar_table_106 values(32431);
alter table create_columnar_table_106 truncate partition create_columnar_table_partition_p6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
insert into create_columnar_table_106 values(32431);
select * from create_columnar_table_106;
c_smallint | c_double_precision | c_time_without_time_zone | c_time_with_time_zone | c_integer | c_bigint | c_decimal | c_real | c_numeric | c_varchar | c_char | c_timestamp_with_timezone | c_char2 | c_text | c_varchar2 | c_timestamp_without_timezone | c_date | c_varchar22 | c_numeric2

View File

@ -114,8 +114,10 @@ Options: orientation=row, compression=no
--check for drop partition (for)
--success, drop partition time_2009
ALTER TABLE range_sales DROP PARTITION time_2009;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success, drop partition time_2011
ALTER TABLE range_sales DROP PARTITION FOR ('2011-06-01');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, invalid type
ALTER TABLE range_sales DROP PARTITION FOR (1);
ERROR: partition key value must be const or const-evaluable expression
@ -128,6 +130,7 @@ ERROR: Un-support feature
DETAIL: Can not drop subpartition against NON-SUBPARTITIONED table
--success, drop partition time_2012
ALTER TABLE range_sales DROP PARTITION FOR ('2011-06-01');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--check for ok after drop
SELECT count(*) FROM range_sales;
count
@ -295,8 +298,10 @@ Options: orientation=row, compression=no
--check for drop partition (for)
--success, drop partition time_2009
ALTER TABLE range2_sales DROP PARTITION time_2009;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success, drop partition time_2011
ALTER TABLE range2_sales DROP PARTITION FOR ('2011-06-01', 600);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, invalid type
ALTER TABLE range2_sales DROP PARTITION FOR (1, 100);
ERROR: partition key value must be const or const-evaluable expression
@ -309,6 +314,7 @@ ERROR: Un-support feature
DETAIL: Can not drop subpartition against NON-SUBPARTITIONED table
--success, drop partition time_2012
ALTER TABLE range2_sales DROP PARTITION FOR ('2011-06-01', 100);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--check for ok after drop
SELECT count(*) FROM range2_sales;
count
@ -460,8 +466,10 @@ Options: orientation=row, compression=no
--check for drop partition (for)
--success, drop partition time_2009
ALTER TABLE interval_sales DROP PARTITION time_2009;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success, drop partition sys_p1
ALTER TABLE interval_sales DROP PARTITION FOR ('2011-06-01');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, invalid type
ALTER TABLE interval_sales DROP PARTITION FOR (1);
ERROR: partition key value must be const or const-evaluable expression
@ -634,8 +642,10 @@ Options: orientation=row, compression=no
--check for drop partition (for)
--success, drop partition channel2
ALTER TABLE list_sales DROP PARTITION channel2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success, drop partition channel3
ALTER TABLE list_sales DROP PARTITION FOR ('6');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, invalid type
ALTER TABLE list_sales DROP PARTITION FOR (10);
ERROR: value too long for type character(1)
@ -648,6 +658,7 @@ ERROR: Un-support feature
DETAIL: Can not drop subpartition against NON-SUBPARTITIONED table
--success, drop partition channel_default
ALTER TABLE list_sales DROP PARTITION FOR ('6');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--check for ok after drop
SELECT count(*) FROM list_sales;
count

View File

@ -1588,6 +1588,7 @@ DROP TABLE IF EXISTS t_alter_partition_temp;
ALTER TABLE t_multi_keys_list_default ADD PARTITION p5 VALUES ((2,1));
ERROR: list boundary of adding partition MUST NOT overlap with existing partition
ALTER TABLE t_multi_keys_list_default DROP PARTITION FOR (1,'5');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ALTER TABLE t_multi_keys_list_default DROP PARTITION FOR (2,'1') UPDATE GLOBAL INDEX;
SELECT * FROM t_multi_keys_list_default PARTITION FOR (1,'5') ORDER BY a,b;
ERROR: Cannot find partition by the value

View File

@ -39,12 +39,14 @@ SELECT COUNT(*) FROM range_test1_v3;
-- do DDL on destination partition
ALTER TABLE range_test1 DROP PARTITION p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- the partition is missing, error
SELECT COUNT(*) FROM range_test1_v1;
--?ERROR: fail to find partition with oid .* for partitioned table .*
DETAIL: this partition may have already been dropped by DDL operation
HINT: Check if this query contains a view that refrences the target partition. If so, REBUILD this view.
ALTER TABLE range_test1 TRUNCATE PARTITION p2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- the partition is reserved, success
SELECT COUNT(*) FROM range_test1_v2;
count
@ -120,12 +122,14 @@ SELECT COUNT(*) FROM range_range_test1_v4;
-- do DDL on destination partition
ALTER TABLE range_range_test1 DROP SUBPARTITION p1_1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- the subpartition p1_1 is missing
SELECT COUNT(*) FROM range_range_test1_v2;
--?ERROR: fail to find subpartition with oid .* for partitioned table .*
DETAIL: this subpartition may have already been dropped by DDL operation
HINT: Check if this query contains a view that refrences the target subpartition. If so, REBUILD this view.
ALTER TABLE range_range_test1 DROP PARTITION p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- the partition p1 is missing
SELECT COUNT(*) FROM range_range_test1_v1;
--?ERROR: fail to find partition with oid .* for partitioned table .*

View File

@ -19,6 +19,7 @@ select count(*) from hash_partition_truncate_table;
--4 rows
alter table hash_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -27,7 +28,9 @@ select count(*) from hash_partition_truncate_table;
--2 rows
alter table hash_partition_truncate_table truncate partition for (1);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table hash_partition_truncate_table truncate partition for (3);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -57,6 +60,7 @@ partition by hash (c1)
);
insert into hash_partition_truncate_table values(1),(2),(3),(4);
alter table hash_partition_truncate_table truncate partition for (1), truncate partition p6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ERROR: partition "p6" does not exist
select count(*) from hash_partition_truncate_table;
count
@ -66,6 +70,8 @@ select count(*) from hash_partition_truncate_table;
-- 4 rows
alter table hash_partition_truncate_table truncate partition for (1), truncate partition for (3);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -117,6 +123,7 @@ select count(*) from hash_partition_truncate_table;
--4 rows
alter table hash_partition_truncate_table truncate partition for (3);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -125,6 +132,7 @@ select count(*) from hash_partition_truncate_table;
--2 rows
alter table hash_partition_truncate_table truncate partition for (2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -154,6 +162,7 @@ select count(*) from hash_partition_truncate_table;
--5 rows
alter table hash_partition_truncate_table truncate partition for (3);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -162,6 +171,7 @@ select count(*) from hash_partition_truncate_table;
--3 rows
alter table hash_partition_truncate_table truncate partition for (2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -193,6 +203,7 @@ select count(*) from hash_partition_truncate_table;
--5 rows
alter table hash_partition_truncate_table truncate partition for (3);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -227,6 +238,7 @@ select count(*) from hash_partition_truncate_table;
--5 rows
alter table hash_partition_truncate_table truncate partition for (3);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -263,6 +275,8 @@ select count(*) from hash_partition_truncate_table;
--5 rows
alter table hash_partition_truncate_table truncate partition for (4), truncate partition for(3);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -605,6 +619,7 @@ select count(*) from hash_partition_truncate_table;
--4 rows
alter table hash_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -613,7 +628,9 @@ select count(*) from hash_partition_truncate_table;
--2 rows
alter table hash_partition_truncate_table truncate partition for (1);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table hash_partition_truncate_table truncate partition for (3);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------
@ -643,6 +660,7 @@ partition by hash (c1)
);
insert into hash_partition_truncate_table values(1),(2),(3),(4);
alter table hash_partition_truncate_table truncate partition for (1), truncate partition p6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ERROR: partition "p6" does not exist
select count(*) from hash_partition_truncate_table;
count
@ -652,6 +670,8 @@ select count(*) from hash_partition_truncate_table;
-- 4 rows
alter table hash_partition_truncate_table truncate partition for (1), truncate partition for (3);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from hash_partition_truncate_table;
count
-------

View File

@ -66,6 +66,7 @@ explain (costs off, verbose on) select * from interval_tab1 where logdate >= '20
(7 rows)
alter table interval_tab1 drop partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select relname, parttype, partstrategy, boundaries from pg_partition;
relname | parttype | partstrategy | boundaries
---------------+----------+--------------+--------------
@ -80,6 +81,7 @@ select relname, parttype, partstrategy, boundaries from pg_partition;
(8 rows)
alter table interval_tab1 merge partitions sys_p5, sys_p6 into partition sys_p5_p6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select relname, parttype, partstrategy, boundaries from pg_partition;
relname | parttype | partstrategy | boundaries
---------------+----------+--------------+--------------
@ -127,6 +129,7 @@ select * from interval_tab1 partition(sys_p1);
(3 rows)
alter table interval_tab1 split partition sys_p1 at (to_date('2020-03-02', 'YYYY-MM-DD')) into (partition sys_p1_1, partition sys_p1_2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select relname, parttype, partstrategy, boundaries from pg_partition;
relname | parttype | partstrategy | boundaries
---------------+----------+--------------+--------------

View File

@ -55,6 +55,7 @@ insert into interval_exchange_test values ('2020-02-26');
-- The data they have belongs to the same range.
ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (interval_normal_exchange_p1)
WITH TABLE interval_exchange_test;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_normal_exchange partition (interval_normal_exchange_p1)order by logdate;
logdate
--------------------------
@ -74,6 +75,7 @@ select * from interval_exchange_test order by logdate;
-- exchange back
ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (interval_normal_exchange_p1)
WITH TABLE interval_exchange_test;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_normal_exchange partition (interval_normal_exchange_p1)order by logdate;
logdate
--------------------------
@ -99,6 +101,7 @@ ERROR: some rows in table do not qualify for specified partition
-- WITHOUT VALIDATION and the exchange will be success, but some date will in the wrong range;
ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (interval_normal_exchange_p1)
WITH TABLE interval_exchange_test WITHOUT VALIDATION;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_normal_exchange partition (interval_normal_exchange_p1)order by logdate;
logdate
--------------------------
@ -135,6 +138,7 @@ insert into interval_exchange_test values ('2020-5-06');
-- exchange table
ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (sys_p1)
WITH TABLE interval_exchange_test;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_normal_exchange partition (sys_p1)order by logdate;
logdate
--------------------------
@ -154,6 +158,7 @@ select * from interval_exchange_test order by logdate;
-- exchange back
ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (sys_p1)
WITH TABLE interval_exchange_test;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_normal_exchange partition (sys_p1)order by logdate;
logdate
--------------------------
@ -178,6 +183,7 @@ ERROR: some rows in table do not qualify for specified partition
-- WITHOUT VALIDATION and the exchange will be success, but some date will in the wrong range;
ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (interval_normal_exchange_p1)
WITH TABLE interval_exchange_test WITHOUT VALIDATION;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_normal_exchange partition (interval_normal_exchange_p1)order by logdate;
logdate
--------------------------
@ -251,6 +257,7 @@ insert into partition_table_001 values (4,'ddd',4,'2020-05-23',false,'ddd',4.4);
insert into partition_table_001 values (5,'eee',5,'2020-06-23',true,'eee',5.5);
insert into partition_table_001 values (6,'fff',6,'2020-07-23',false,'fff',6.6);
ALTER TABLE partition_table_001 EXCHANGE PARTITION (sys_p1) WITH TABLE table_001;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from table_001 order by 1;
col_1 | col_2 | col_3 | col_4 | col_5 | col_6 | col_7
-------+-------+-------+--------------------------+-------+-------+-------
@ -282,6 +289,7 @@ select relname, parttype, partstrategy, boundaries from pg_partition
(7 rows)
ALTER TABLE partition_table_001 EXCHANGE PARTITION (sys_p1) WITH TABLE table_001;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from table_001 order by 1;
col_1 | col_2 | col_3 | col_4 | col_5 | col_6 | col_7
-------+-------+-------+-------+-------+-------+-------
@ -300,6 +308,7 @@ select * from partition_table_001 order by 1;
insert into table_001 values (7,'eee',7,'2020-08-23',true,'eee',7.7);
ALTER TABLE partition_table_001 EXCHANGE PARTITION (sys_p1) WITH TABLE table_001 with validation verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from table_001 order by 1;
col_1 | col_2 | col_3 | col_4 | col_5 | col_6 | col_7
-------+-------+-------+--------------------------+-------+-------+-------

View File

@ -31,6 +31,7 @@ prepare pg_partition_sql(char) as
PARTITION p1 VALUES LESS THAN (TO_DATE('6-5-2008', 'DD-MM-YYYY'))
);
alter table interval_sales split partition p0 at (to_date('2007-02-10', 'YYYY-MM-DD')) into (partition p0_1, partition p0_2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
execute pg_partition_sql('interval_sales');
relname | parttype | rangenum | intervalnum | partstrategy | interval | boundary
----------------+----------+----------+-------------+--------------+-------------+------------
@ -124,6 +125,7 @@ ERROR: source partitions must be continuous and in ascending order of boundary
(16 rows)
alter table interval_sales merge partitions p0_1, p0_2, p1 into partition p01;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
execute pg_partition_sql('interval_sales');
relname | parttype | rangenum | intervalnum | partstrategy | interval | boundary
----------------+----------+----------+-------------+--------------+-------------+------------
@ -223,6 +225,7 @@ ERROR: source partitions must be continuous and in ascending order of boundary
(14 rows)
alter table interval_sales merge partitions sys_p6, sys_p7, sys_p8 into partition sys_p6_p7_p8;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select *
from interval_sales partition (sys_p6);
ERROR: partition "sys_p6" of relation "interval_sales" does not exist
@ -261,6 +264,7 @@ ERROR: partition "sys_p8" of relation "interval_sales" does not exist
-- 2.3 merge interval partition and range partition
-- FIRST, build a range partition which is continuous with a interval partition
alter table interval_sales merge partitions sys_p2, sys_p1 into partition sys_p2_p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- 2.3.1 merge sys_p2_p1 with sys_p3 in wrong order
alter table interval_sales merge partitions sys_p3, sys_p2_p1 into partition sys_p2_p1_p3;
ERROR: source partitions must be continuous and in ascending order of boundary
@ -282,6 +286,7 @@ ERROR: source partitions must be continuous and in ascending order of boundary
(1 row)
alter table interval_sales merge partitions sys_p2_p1, sys_p3 into partition sys_p2_p1_p3;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select *
from interval_sales partition (sys_p2_p1_p3);
prod_id | cust_id | time_id | channel_id | promo_id | quantity_sold | amount_sold
@ -312,6 +317,7 @@ ERROR: source partitions must be continuous and in ascending order of boundary
ERROR: source partitions must be continuous and in ascending order of boundary
-- 2.4.1 merge interval partition and range partition into one in right order
alter table interval_sales merge partitions sys_p2_p1_p3, sys_p9 into partition sys_p9_p2_p1_p3;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select *
from interval_sales partition (sys_p9_p2_p1_p3);
prod_id | cust_id | time_id | channel_id | promo_id | quantity_sold | amount_sold

View File

@ -14,6 +14,7 @@ INTERVAL('1 MONTH')
PARTITION p1 VALUES LESS THAN (TO_DATE('6-5-2008', 'DD-MM-YYYY'))
);
alter table interval_sales split partition p0 at (to_date('2007-02-10', 'YYYY-MM-DD')) into (partition p0_1, partition p0_2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_sales order by time_id;
prod_id | cust_id | time_id | channel_id | promo_id | quantity_sold | amount_sold
---------+---------+---------+------------+----------+---------------+-------------
@ -67,6 +68,7 @@ select * from interval_sales partition(sys_p1) order by time_id;
(2 rows)
alter table interval_sales split partition sys_p1 at (to_date('2009-02-10', 'YYYY-MM-DD')) into (partition sys_p1_1, partition sys_p1_2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_sales partition(sys_p1_1) order by time_id;
prod_id | cust_id | time_id | channel_id | promo_id | quantity_sold | amount_sold
---------+---------+--------------------------+------------+----------+---------------+-------------
@ -106,6 +108,7 @@ select * from interval_sales partition(sys_p2) order by time_id;
(1 row)
alter table interval_sales split partition sys_p2 at (to_date('2009-01-10', 'YYYY-MM-DD')) into (partition sys_p2_1, partition sys_p2_2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_sales partition(sys_p2_1) order by time_id;
prod_id | cust_id | time_id | channel_id | promo_id | quantity_sold | amount_sold
---------+---------+---------+------------+----------+---------------+-------------
@ -145,6 +148,7 @@ select * from interval_sales partition(sys_p3) order by time_id;
(1 row)
alter table interval_sales split partition sys_p3 at (to_date('2009-04-5', 'YYYY-MM-DD')) into (partition sys_p3_1, partition sys_p3_2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_sales partition(sys_p3_1) order by time_id;
prod_id | cust_id | time_id | channel_id | promo_id | quantity_sold | amount_sold
---------+---------+---------+------------+----------+---------------+-------------
@ -262,6 +266,7 @@ select * from interval_sales partition(sys_p4) order by time_id;
(2 rows)
alter table interval_sales split partition sys_p4 at (to_date('2009-07-10', 'YYYY-MM-DD')) into (partition sys_p4_1, partition sys_p4_2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_sales partition(sys_p4_1) order by time_id;
prod_id | cust_id | time_id | channel_id | promo_id | quantity_sold | amount_sold
---------+---------+---------+------------+----------+---------------+-------------
@ -316,6 +321,7 @@ alter table interval_sales split partition p1 into
partition p1_2 values less than (to_date('2008-03-06', 'YYYY-MM-DD')),
partition p1_3 values less than (to_date('2008-04-06', 'YYYY-MM-DD')),
partition p1_4 values less than (to_date('2008-05-06', 'YYYY-MM-DD')));
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_sales partition(p1_1)order by time_id;
prod_id | cust_id | time_id | channel_id | promo_id | quantity_sold | amount_sold
---------+---------+---------+------------+----------+---------------+-------------
@ -356,6 +362,7 @@ alter table interval_sales split partition sys_p6 into
partition sys_p6_2 values less than (to_date('2018-10-29', 'YYYY-MM-DD')),
partition sys_p6_3 values less than (to_date('2018-11-01', 'YYYY-MM-DD')),
partition sys_p6_4 values less than (to_date('2018-11-06', 'YYYY-MM-DD')));
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_sales partition(sys_p6_1)order by time_id;
prod_id | cust_id | time_id | channel_id | promo_id | quantity_sold | amount_sold
---------+---------+---------+------------+----------+---------------+-------------

View File

@ -366,6 +366,7 @@ ERROR: index mismatch for tables in ALTER TABLE EXCHANGE PARTITION
ALTER INDEX idx1_partition_unsable_index_1 REBUILD PARTITION idx1_partition_unsable_index_1_p1;
ALTER TABLE partition_unsable_index_1 EXCHANGE PARTITION (partition_unsable_index_1_p0)
WITH TABLE table_unusable_index_exchange;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- clean table_unusable_index_exchange
DROP TABLE table_unusable_index_exchange;
DROP TABLE partition_unsable_index_1;

View File

@ -59,6 +59,7 @@ alter table test_partition_for_null_list drop partition for (null);
ERROR: The partition number is invalid or out-of-range
-- success
alter table test_partition_for_null_list drop partition for (0);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- failed
select * from test_partition_for_null_list partition (test_partition_for_null_list_part1) order by 1, 2, 3, 4;
ERROR: partition "test_partition_for_null_list_part1" of relation "test_partition_for_null_list" does not exist

View File

@ -22,6 +22,7 @@ select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -30,6 +31,7 @@ select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table truncate partition for (2000);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -65,6 +67,7 @@ alter table list_partition_truncate_table truncate partition for (6000);
ERROR: The partition number is invalid or out-of-range
--error
alter table list_partition_truncate_table truncate partition for (5000), truncate partition for (6000);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ERROR: The partition number is invalid or out-of-range
select count(*) from list_partition_truncate_table;
count
@ -74,6 +77,7 @@ select count(*) from list_partition_truncate_table;
-- 5 rows
alter table list_partition_truncate_table truncate partition for (5000), truncate partition p6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ERROR: partition "p6" does not exist
select count(*) from list_partition_truncate_table;
count
@ -83,6 +87,8 @@ select count(*) from list_partition_truncate_table;
-- 5 rows
alter table list_partition_truncate_table truncate partition for (5000), truncate partition p2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -140,6 +146,7 @@ select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -148,6 +155,7 @@ select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table truncate partition for (2000);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -180,6 +188,7 @@ select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -188,6 +197,7 @@ select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table truncate partition for (2000);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -222,6 +232,7 @@ select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -259,6 +270,7 @@ select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -300,6 +312,7 @@ select count(*) from list_partition_truncate_table;
--5 rows
start transaction ;
alter table list_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -308,6 +321,7 @@ select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table drop partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
rollback;
select count(*) from list_partition_truncate_table;
count
@ -318,6 +332,7 @@ select count(*) from list_partition_truncate_table;
--5 rows
start transaction ;
alter table list_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -368,6 +383,7 @@ select count(*) from list_partition_truncate_table;
--6 rows
alter table list_partition_truncate_table truncate partition p6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -417,6 +433,7 @@ select count(*) from list_partition_truncate_table;
--6 rows
alter table list_partition_truncate_table truncate partition p6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -456,6 +473,8 @@ select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1, truncate partition for(1000);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -468,6 +487,8 @@ start transaction;
alter table list_partition_truncate_table add partition p6 values (6000);
insert into list_partition_truncate_table values(6000,'0');
alter table list_partition_truncate_table truncate partition p6, truncate partition for(6000);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table partition(p6);
count
-------
@ -483,6 +504,8 @@ start transaction;
alter table list_partition_truncate_table add partition p6 values (6000);
insert into list_partition_truncate_table values(6000,'0');
alter table list_partition_truncate_table truncate partition p6, truncate partition for(6000);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table partition(p6);
count
-------
@ -834,6 +857,7 @@ select count(*) from list_partition_truncate_table;
--5 rows
alter table list_partition_truncate_table truncate partition p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -842,6 +866,7 @@ select count(*) from list_partition_truncate_table;
--4 rows
alter table list_partition_truncate_table truncate partition for (2000);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------
@ -877,6 +902,7 @@ alter table list_partition_truncate_table truncate partition for (6000);
ERROR: The partition number is invalid or out-of-range
--error
alter table list_partition_truncate_table truncate partition for (5000), truncate partition for (6000);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ERROR: The partition number is invalid or out-of-range
select count(*) from list_partition_truncate_table;
count
@ -886,6 +912,7 @@ select count(*) from list_partition_truncate_table;
-- 5 rows
alter table list_partition_truncate_table truncate partition for (5000), truncate partition p6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ERROR: partition "p6" does not exist
select count(*) from list_partition_truncate_table;
count
@ -895,6 +922,8 @@ select count(*) from list_partition_truncate_table;
-- 5 rows
alter table list_partition_truncate_table truncate partition for (5000), truncate partition p2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from list_partition_truncate_table;
count
-------

View File

@ -19,6 +19,7 @@ partition by range (a)
create table test_ord (a int);
insert into test_ord values (11);
alter table test_exchange_llt exchange partition (test_exchange_llt_p2) with table test_ord with validation;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_llt;
drop table test_ord;
-- get_rel_oids

View File

@ -67,6 +67,7 @@ EXECUTE partition_get_partitionno('range_sales');
-- add/drop partition
ALTER TABLE range_sales ADD PARTITION time_default VALUES LESS THAN (MAXVALUE);
ALTER TABLE range_sales DROP PARTITION time_2008;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
EXECUTE partition_get_partitionno('range_sales');
relname | partitionno | subpartitionno | boundaries
--------------+-------------+----------------+--------------
@ -79,6 +80,7 @@ EXECUTE partition_get_partitionno('range_sales');
-- merge/split partition
ALTER TABLE range_sales SPLIT PARTITION time_default AT ('2013-01-01') INTO (PARTITION time_2012, PARTITION time_default_temp);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ALTER TABLE range_sales RENAME PARTITION time_default_temp TO time_default;
ALTER TABLE range_sales MERGE PARTITIONS time_2009, time_2010 INTO PARTITION time_2010_old UPDATE GLOBAL INDEX;
EXECUTE partition_get_partitionno('range_sales');
@ -163,6 +165,7 @@ EXECUTE partition_get_partitionno('interval_sales');
INSERT INTO interval_sales VALUES (1,1,'2013-01-01','A',1,1,1);
INSERT INTO interval_sales VALUES (2,2,'2012-01-01','B',2,2,2);
ALTER TABLE interval_sales DROP PARTITION time_2008;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
EXECUTE partition_get_partitionno('interval_sales');
relname | partitionno | subpartitionno | boundaries
----------------+-------------+----------------+------------------------------
@ -175,6 +178,7 @@ EXECUTE partition_get_partitionno('interval_sales');
-- merge/split partition
ALTER TABLE interval_sales SPLIT PARTITION time_2009 AT ('2009-01-01') INTO (PARTITION time_2008, PARTITION time_2009_temp);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ALTER TABLE interval_sales RENAME PARTITION time_2009_temp TO time_2009;
ALTER TABLE interval_sales MERGE PARTITIONS time_2009, time_2010 INTO PARTITION time_2010_old UPDATE GLOBAL INDEX;
EXECUTE partition_get_partitionno('interval_sales');
@ -260,6 +264,7 @@ EXECUTE partition_get_partitionno('list_sales');
-- add/drop partition
ALTER TABLE list_sales ADD PARTITION channel_default VALUES (DEFAULT);
ALTER TABLE list_sales DROP PARTITION channel4;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
EXECUTE partition_get_partitionno('list_sales');
relname | partitionno | subpartitionno | boundaries
-----------------+-------------+----------------+------------
@ -362,6 +367,7 @@ EXECUTE subpartition_get_partitionno('list_range_sales');
-- add/drop partition
ALTER TABLE list_range_sales DROP PARTITION channel3;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ALTER TABLE list_range_sales ADD PARTITION channel3 VALUES ('6', '7')
(
SUBPARTITION channel3_customer1 VALUES LESS THAN (200),
@ -395,6 +401,7 @@ EXECUTE subpartition_get_partitionno('list_range_sales');
-- merge/split partition
ALTER TABLE list_range_sales SPLIT SUBPARTITION channel2_customer2 AT (800) INTO (SUBPARTITION channel2_customer3, SUBPARTITION channel2_customer4);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
EXECUTE subpartition_get_partitionno('list_range_sales');
relname | partitionno | subpartitionno | boundaries
--------------------------+-------------+----------------+------------

View File

@ -187,14 +187,17 @@ Options: orientation=row, compression=no
--check for drop partition/subpartition (for)
--success, drop partition customer2
ALTER TABLE range_range_sales DROP PARTITION customer2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success
ALTER TABLE range_range_sales DROP SUBPARTITION customer1_2008;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition
ALTER TABLE range_range_sales DROP SUBPARTITION customer4_all;
ERROR: Cannot drop the only subpartition of a partitioned table
DETAIL: N/A
--success, drop partition customer3
ALTER TABLE range_range_sales DROP PARTITION FOR (400);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE range_range_sales DROP PARTITION FOR (400, '2010-01-01');
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -210,6 +213,7 @@ ALTER TABLE range_range_sales DROP SUBPARTITION FOR ('2010-01-01', 1400);
ERROR: invalid input syntax for integer: "2010-01-01"
--success, drop subpartition customer5_2010
ALTER TABLE range_range_sales DROP SUBPARTITION FOR(1400, '2010-01-01');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in customer6
ALTER TABLE range_range_sales DROP SUBPARTITION FOR(2000, '2009-01-01');
ERROR: Cannot drop the only subpartition of a partitioned table
@ -475,14 +479,17 @@ Options: orientation=row, compression=no
--check for drop partition/subpartition (for)
--success, drop partition customer2
ALTER TABLE range_list_sales DROP PARTITION customer2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success
ALTER TABLE range_list_sales DROP SUBPARTITION customer1_channel1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition
ALTER TABLE range_list_sales DROP SUBPARTITION customer4_channel1;
ERROR: Cannot drop the only subpartition of a partitioned table
DETAIL: N/A
--success, drop partition customer3
ALTER TABLE range_list_sales DROP PARTITION FOR (400);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE range_list_sales DROP PARTITION FOR (400, '4');
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -498,6 +505,7 @@ ALTER TABLE range_list_sales DROP SUBPARTITION FOR ('abc', 1400);
ERROR: invalid input syntax for integer: "abc"
--success, drop subpartition customer5_channel3
ALTER TABLE range_list_sales DROP SUBPARTITION FOR(1400, '7');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in customer6
ALTER TABLE range_list_sales DROP SUBPARTITION FOR(2000, 'X');
ERROR: Cannot drop the only subpartition of a partitioned table
@ -742,6 +750,7 @@ Options: orientation=row, compression=no
--check for drop partition/subpartition (for)
--success, drop partition customer2
ALTER TABLE range_hash_sales DROP PARTITION customer2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, not support drop hash
ALTER TABLE range_hash_sales DROP SUBPARTITION customer1_product1;
ERROR: Un-support feature
@ -752,6 +761,7 @@ ERROR: Un-support feature
DETAIL: The syntax is unsupported for hash subpartition
--success, drop partition customer3
ALTER TABLE range_hash_sales DROP PARTITION FOR (400);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE range_hash_sales DROP PARTITION FOR (400, '2010-01-01');
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -1014,14 +1024,17 @@ Options: orientation=row, compression=no
--check for drop partition/subpartition (for)
--success, drop partition channel2
ALTER TABLE list_range_sales DROP PARTITION channel2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success
ALTER TABLE list_range_sales DROP SUBPARTITION channel1_customer1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition
ALTER TABLE list_range_sales DROP SUBPARTITION channel4_customer1;
ERROR: Cannot drop the only subpartition of a partitioned table
DETAIL: N/A
--success, drop partition channel3
ALTER TABLE list_range_sales DROP PARTITION FOR ('6');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE list_range_sales DROP PARTITION FOR('X', 700);
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -1037,6 +1050,7 @@ ALTER TABLE list_range_sales DROP SUBPARTITION FOR(700, 'X');
ERROR: value too long for type character(1)
--success, drop subpartition channel5_customer3
ALTER TABLE list_range_sales DROP SUBPARTITION FOR('X', 700);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in channel6
ALTER TABLE list_range_sales DROP SUBPARTITION FOR('K', 100);
ERROR: Cannot drop the only subpartition of a partitioned table
@ -1305,14 +1319,17 @@ Options: orientation=row, compression=no
--check for drop partition/subpartition (for)
--success, drop partition channel2
ALTER TABLE list_list_sales DROP PARTITION channel2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success
ALTER TABLE list_list_sales DROP SUBPARTITION channel1_type1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition
ALTER TABLE list_list_sales DROP SUBPARTITION channel4_type1;
ERROR: Cannot drop the only subpartition of a partitioned table
DETAIL: N/A
--success, drop partition channel3
ALTER TABLE list_list_sales DROP PARTITION FOR ('6');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE list_list_sales DROP PARTITION FOR('X', 6);
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -1328,6 +1345,7 @@ ALTER TABLE list_list_sales DROP SUBPARTITION FOR(10, 'X');
ERROR: value too long for type character(1)
--success, drop subpartition channel5_type3
ALTER TABLE list_list_sales DROP SUBPARTITION FOR('X', 6);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in channel6
ALTER TABLE list_list_sales DROP SUBPARTITION FOR('K', 10);
ERROR: Cannot drop the only subpartition of a partitioned table

View File

@ -162,6 +162,7 @@ Options: orientation=row, compression=no
--check for drop partition/subpartition (for)
--success, drop partition channel2
ALTER TABLE list_hash_sales DROP PARTITION channel2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, not support drop hash
ALTER TABLE list_hash_sales DROP SUBPARTITION channel1_product1;
ERROR: Un-support feature
@ -172,6 +173,7 @@ ERROR: Un-support feature
DETAIL: The syntax is unsupported for hash subpartition
--success, drop partition channel3
ALTER TABLE list_hash_sales DROP PARTITION FOR ('6');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE list_hash_sales DROP PARTITION FOR ('6', '2010-01-01');
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -414,8 +416,10 @@ ALTER TABLE hash_range_sales DROP PARTITION product2;
ERROR: Droping hash partition is unsupported.
--success, drop subpartition product1_customer1
ALTER TABLE hash_range_sales DROP SUBPARTITION product1_customer1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success, drop subpartition product4_customer1
ALTER TABLE hash_range_sales DROP SUBPARTITION product4_customer1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in product4
ALTER TABLE hash_range_sales DROP SUBPARTITION product4_customer2;
ERROR: Cannot drop the only subpartition of a partitioned table
@ -435,6 +439,7 @@ ALTER TABLE hash_range_sales DROP SUBPARTITION FOR('2010-01-01', 100);
ERROR: invalid input syntax for integer: "2010-01-01"
--success, drop subpartition product1_customer2, but not suggest to do this operation
ALTER TABLE hash_range_sales DROP SUBPARTITION FOR(0, 100);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, no subpartition find
ALTER TABLE hash_range_sales DROP SUBPARTITION FOR(0, 2300);
ERROR: The subpartition number is invalid or out-of-range
@ -668,8 +673,10 @@ ALTER TABLE hash_list_sales DROP PARTITION product2;
ERROR: Droping hash partition is unsupported.
--success, drop subpartition product1_channel1
ALTER TABLE hash_list_sales DROP SUBPARTITION product1_channel1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success, drop subpartition product4_channel1
ALTER TABLE hash_list_sales DROP SUBPARTITION product4_channel1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in product4
ALTER TABLE hash_list_sales DROP SUBPARTITION product4_channel2;
ERROR: Cannot drop the only subpartition of a partitioned table
@ -689,6 +696,7 @@ ALTER TABLE hash_list_sales DROP SUBPARTITION FOR('2010-01-01', '4');
ERROR: invalid input syntax for integer: "2010-01-01"
--success, drop subpartition product1_channel2, but not suggest to do this operation
ALTER TABLE hash_list_sales DROP SUBPARTITION FOR(0, '4');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, no subpartition find
ALTER TABLE hash_list_sales DROP SUBPARTITION FOR(0, 'Z');
ERROR: The subpartition number is invalid or out-of-range

View File

@ -93,6 +93,7 @@ LINE 1: ALTER TABLE range_range EXCHANGE SUBPARTITION (p_201901) WIT...
^
-- drop
alter table range_range drop partition p_201901;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table range_range drop partition p_201901_a;
ERROR: partition "p_201901_a" does not exist
alter table range_range drop subpartition p_201901_a;

View File

@ -262,6 +262,7 @@ SELECT /*+ indexonlyscan(range_list_sales1 range_list_sales1_idx4) */ COUNT(time
--4. if drop partition without update global index, the gpi will be invalid, we can rebuild the index
ALTER TABLE range_list_sales1 DROP PARTITION FOR (1600);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
EXPLAIN(costs off) SELECT /*+ indexonlyscan(range_list_sales1 range_list_sales1_idx1) */ COUNT(product_id) FROM range_list_sales1;
WARNING: Error hint: IndexOnlyScan(range_list_sales1 range_list_sales1_idx1), index "range_list_sales1_idx1" doesn't exist.
QUERY PLAN
@ -350,6 +351,7 @@ SELECT /*+ indexonlyscan(range_list_sales1 range_list_sales1_idx4) */ COUNT(time
--5. if drop subpartition without update global index, the gpi will be invalid, we can rebuild the index
ALTER TABLE range_list_sales1 DROP SUBPARTITION customer5_channel3;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
EXPLAIN(costs off) SELECT /*+ indexonlyscan(range_list_sales1 range_list_sales1_idx1) */ COUNT(product_id) FROM range_list_sales1;
WARNING: Error hint: IndexOnlyScan(range_list_sales1 range_list_sales1_idx1), index "range_list_sales1_idx1" doesn't exist.
QUERY PLAN

View File

@ -454,6 +454,7 @@ select * from range_list where user_no = '1' order by 1, 2, 3, 4;
(3 rows)
alter table range_list truncate subpartition p_201901_b;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
explain(costs off, verbose on) select * from range_list where month_code = '201902' order by 1, 2, 3, 4;
QUERY PLAN
----------------------------------------------------------------------------------
@ -721,6 +722,7 @@ alter table range_list split subpartition p_201902_b values ('3') into
subpartition p_201902_b,
subpartition p_201902_c
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
explain(costs off, verbose on) select * from range_list where month_code = '201902' order by 1, 2, 3, 4;
QUERY PLAN
----------------------------------------------------------------------------------
@ -995,6 +997,7 @@ alter table range_range split subpartition p_201902_b at ('3') into
subpartition p_201902_c,
subpartition p_201903_d
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
explain(costs off, verbose on) select * from range_range where month_code = '201902' order by 1, 2, 3, 4;
QUERY PLAN
-----------------------------------------------------------------------------------

View File

@ -74,6 +74,7 @@ alter table list_list split subpartition p_201901_b values (2) into
subpartition p_201901_b,
subpartition p_201901_c
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201901_a) order by 1,2,3,4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -118,6 +119,7 @@ alter table list_list split subpartition p_201902_b values (2, 3) into
subpartition p_201902_b,
subpartition p_201902_c
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201902_a) order by 1,2,3,4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -220,6 +222,7 @@ alter table range_range split subpartition p_201901_b at (3) into
subpartition p_201901_c,
subpartition p_201901_d
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from range_range subpartition (p_201901_a) order by 1,2,3,4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -258,6 +261,7 @@ alter table range_range split subpartition p_201902_b at (3) into
subpartition p_201902_c,
subpartition p_201902_d
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from range_range subpartition (p_201902_a) order by 1,2,3,4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------

View File

@ -50,6 +50,7 @@ select * from list_list partition (p_201901);
(3 rows)
alter table list_list truncate partition p_201901;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list partition (p_201901);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -64,6 +65,7 @@ select * from list_list partition (p_201902);
(3 rows)
alter table list_list truncate partition p_201902;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list partition (p_201902);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -88,6 +90,7 @@ select * from list_list subpartition (p_201901_a);
(2 rows)
alter table list_list truncate subpartition p_201901_a;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201901_a);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -100,6 +103,7 @@ select * from list_list subpartition (p_201901_b);
(1 row)
alter table list_list truncate subpartition p_201901_b;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201901_b);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -112,6 +116,7 @@ select * from list_list subpartition (p_201902_a);
(1 row)
alter table list_list truncate subpartition p_201902_a;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201902_a);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -125,6 +130,7 @@ select * from list_list subpartition (p_201902_b);
(2 rows)
alter table list_list truncate subpartition p_201902_b;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201902_b);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------

View File

@ -2235,6 +2235,7 @@ explain delete from t_multi_parts_order partition(p4, p1) limit 10;
(5 rows)
ALTER TABLE t_multi_parts_order MERGE PARTITIONS p1,p2 INTO PARTITION p0;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
begin;
delete from t_multi_parts_order partition(p3, p0, p4) limit 20;
select count(*) from t_multi_parts_order partition (p0);
@ -2267,6 +2268,7 @@ explain delete from t_multi_parts_order partition(p3, p0, p4) limit 20;
(5 rows)
ALTER TABLE t_multi_parts_order SPLIT PARTITION p0 AT ( 10 ) INTO ( PARTITION p1 , PARTITION p2);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
begin;
delete from t_multi_parts_order partition(p3, p2, p4) limit 10;
select count(*) from t_multi_parts_order partition (p2);
@ -2299,6 +2301,7 @@ explain delete from t_multi_parts_order partition(p3, p2, p4) limit 10;
(5 rows)
ALTER TABLE t_multi_parts_order drop partition p4;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ALTER TABLE t_multi_parts_order add partition p5 values less than(50);
ALTER TABLE t_multi_parts_order add partition p6 values less than(60);
ALTER TABLE t_multi_parts_order add partition pmax values less than(maxvalue);

View File

@ -95,6 +95,7 @@ select relname, reloptions from pg_partition where parentid in (Select relfileno
create table normal_test.exchange_table(id int) WITH(compresstype=2,compress_chunk_size=1024);
ALTER TABLE normal_test.tbl_partition EXCHANGE PARTITION FOR(2500) WITH TABLE normal_test.exchange_table;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from normal_test.tbl_partition;
count
-------
@ -103,6 +104,7 @@ select count(*) from normal_test.tbl_partition;
-- spilit
ALTER TABLE normal_test.tbl_partition SPLIT PARTITION p1 AT (7500) INTO (PARTITION p10, PARTITION p11);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select relname, reloptions from pg_partition where parentid in (Select relfilenode from pg_class where relname like 'tbl_partition') order by relname;
relname | reloptions
---------------+----------------------------------------------------------------------------

View File

@ -170,14 +170,17 @@ Options: orientation=row, segment=on, compression=no
--check for drop partition/subpartition (for)
--success, drop partition customer2
ALTER TABLE range_range_sales DROP PARTITION customer2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success
ALTER TABLE range_range_sales DROP SUBPARTITION customer1_2008;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition
ALTER TABLE range_range_sales DROP SUBPARTITION customer4_all;
ERROR: Cannot drop the only subpartition of a partitioned table
DETAIL: N/A
--success, drop partition customer3
ALTER TABLE range_range_sales DROP PARTITION FOR (400);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE range_range_sales DROP PARTITION FOR (400, '2010-01-01');
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -193,6 +196,7 @@ ALTER TABLE range_range_sales DROP SUBPARTITION FOR ('2010-01-01', 1400);
ERROR: invalid input syntax for integer: "2010-01-01"
--success, drop subpartition customer5_2010
ALTER TABLE range_range_sales DROP SUBPARTITION FOR(1400, '2010-01-01');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in customer6
ALTER TABLE range_range_sales DROP SUBPARTITION FOR(2000, '2009-01-01');
ERROR: Cannot drop the only subpartition of a partitioned table
@ -442,14 +446,17 @@ Options: orientation=row, segment=on, compression=no
--check for drop partition/subpartition (for)
--success, drop partition customer2
ALTER TABLE range_list_sales DROP PARTITION customer2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success
ALTER TABLE range_list_sales DROP SUBPARTITION customer1_channel1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition
ALTER TABLE range_list_sales DROP SUBPARTITION customer4_channel1;
ERROR: Cannot drop the only subpartition of a partitioned table
DETAIL: N/A
--success, drop partition customer3
ALTER TABLE range_list_sales DROP PARTITION FOR (400);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE range_list_sales DROP PARTITION FOR (400, '4');
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -465,6 +472,7 @@ ALTER TABLE range_list_sales DROP SUBPARTITION FOR ('abc', 1400);
ERROR: invalid input syntax for integer: "abc"
--success, drop subpartition customer5_channel3
ALTER TABLE range_list_sales DROP SUBPARTITION FOR(1400, '7');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in customer6
ALTER TABLE range_list_sales DROP SUBPARTITION FOR(2000, 'X');
ERROR: Cannot drop the only subpartition of a partitioned table
@ -709,6 +717,7 @@ Options: orientation=row, segment=on, compression=no
--check for drop partition/subpartition (for)
--success, drop partition customer2
ALTER TABLE range_hash_sales DROP PARTITION customer2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, not support drop hash
ALTER TABLE range_hash_sales DROP SUBPARTITION customer1_product1;
ERROR: Un-support feature
@ -719,6 +728,7 @@ ERROR: Un-support feature
DETAIL: The syntax is unsupported for hash subpartition
--success, drop partition customer3
ALTER TABLE range_hash_sales DROP PARTITION FOR (400);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE range_hash_sales DROP PARTITION FOR (400, '2010-01-01');
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -972,14 +982,17 @@ Options: orientation=row, segment=on, compression=no
--check for drop partition/subpartition (for)
--success, drop partition channel2
ALTER TABLE list_range_sales DROP PARTITION channel2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success
ALTER TABLE list_range_sales DROP SUBPARTITION channel1_customer1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition
ALTER TABLE list_range_sales DROP SUBPARTITION channel4_customer1;
ERROR: Cannot drop the only subpartition of a partitioned table
DETAIL: N/A
--success, drop partition channel3
ALTER TABLE list_range_sales DROP PARTITION FOR ('6');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE list_range_sales DROP PARTITION FOR('X', 700);
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -995,6 +1008,7 @@ ALTER TABLE list_range_sales DROP SUBPARTITION FOR(700, 'X');
ERROR: value too long for type character(1)
--success, drop subpartition channel5_customer3
ALTER TABLE list_range_sales DROP SUBPARTITION FOR('X', 700);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in channel6
ALTER TABLE list_range_sales DROP SUBPARTITION FOR('K', 100);
ERROR: Cannot drop the only subpartition of a partitioned table
@ -1244,14 +1258,17 @@ Options: orientation=row, segment=on, compression=no
--check for drop partition/subpartition (for)
--success, drop partition channel2
ALTER TABLE list_list_sales DROP PARTITION channel2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success
ALTER TABLE list_list_sales DROP SUBPARTITION channel1_type1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition
ALTER TABLE list_list_sales DROP SUBPARTITION channel4_type1;
ERROR: Cannot drop the only subpartition of a partitioned table
DETAIL: N/A
--success, drop partition channel3
ALTER TABLE list_list_sales DROP PARTITION FOR ('6');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE list_list_sales DROP PARTITION FOR('X', 6);
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -1267,6 +1284,7 @@ ALTER TABLE list_list_sales DROP SUBPARTITION FOR(10, 'X');
ERROR: value too long for type character(1)
--success, drop subpartition channel5_type3
ALTER TABLE list_list_sales DROP SUBPARTITION FOR('X', 6);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in channel6
ALTER TABLE list_list_sales DROP SUBPARTITION FOR('K', 10);
ERROR: Cannot drop the only subpartition of a partitioned table
@ -1511,6 +1529,7 @@ Options: orientation=row, segment=on, compression=no
--check for drop partition/subpartition (for)
--success, drop partition channel2
ALTER TABLE list_hash_sales DROP PARTITION channel2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, not support drop hash
ALTER TABLE list_hash_sales DROP SUBPARTITION channel1_product1;
ERROR: Un-support feature
@ -1521,6 +1540,7 @@ ERROR: Un-support feature
DETAIL: The syntax is unsupported for hash subpartition
--success, drop partition channel3
ALTER TABLE list_hash_sales DROP PARTITION FOR ('6');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, number not equal to the number of partkey
ALTER TABLE list_hash_sales DROP PARTITION FOR ('6', '2010-01-01');
ERROR: number of boundary items NOT EQUAL to number of partition keys
@ -1763,8 +1783,10 @@ ALTER TABLE hash_range_sales DROP PARTITION product2;
ERROR: Droping hash partition is unsupported.
--success, drop subpartition product1_customer1
ALTER TABLE hash_range_sales DROP SUBPARTITION product1_customer1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success, drop subpartition product4_customer1
ALTER TABLE hash_range_sales DROP SUBPARTITION product4_customer1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in product4
ALTER TABLE hash_range_sales DROP SUBPARTITION product4_customer2;
ERROR: Cannot drop the only subpartition of a partitioned table
@ -1784,6 +1806,7 @@ ALTER TABLE hash_range_sales DROP SUBPARTITION FOR('2010-01-01', 100);
ERROR: invalid input syntax for integer: "2010-01-01"
--success, drop subpartition product1_customer2, but not suggest to do this operation
ALTER TABLE hash_range_sales DROP SUBPARTITION FOR(0, 100);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, no subpartition find
ALTER TABLE hash_range_sales DROP SUBPARTITION FOR(0, 2300);
ERROR: The subpartition number is invalid or out-of-range
@ -2017,8 +2040,10 @@ ALTER TABLE hash_list_sales DROP PARTITION product2;
ERROR: Droping hash partition is unsupported.
--success, drop subpartition product1_channel1
ALTER TABLE hash_list_sales DROP SUBPARTITION product1_channel1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--success, drop subpartition product4_channel1
ALTER TABLE hash_list_sales DROP SUBPARTITION product4_channel1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, the only subpartition in product4
ALTER TABLE hash_list_sales DROP SUBPARTITION product4_channel2;
ERROR: Cannot drop the only subpartition of a partitioned table
@ -2038,6 +2063,7 @@ ALTER TABLE hash_list_sales DROP SUBPARTITION FOR('2010-01-01', '4');
ERROR: invalid input syntax for integer: "2010-01-01"
--success, drop subpartition product1_channel2, but not suggest to do this operation
ALTER TABLE hash_list_sales DROP SUBPARTITION FOR(0, '4');
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--fail, no subpartition find
ALTER TABLE hash_list_sales DROP SUBPARTITION FOR(0, 'Z');
ERROR: The subpartition number is invalid or out-of-range

View File

@ -93,6 +93,7 @@ LINE 1: ALTER TABLE range_range EXCHANGE SUBPARTITION (p_201901) WIT...
^
-- drop
alter table range_range drop partition p_201901;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table range_range drop partition p_201901_a;
ERROR: partition "p_201901_a" does not exist
alter table range_range drop subpartition p_201901_a;

View File

@ -256,6 +256,7 @@ SELECT /*+ indexonlyscan(range_list_sales1 range_list_sales1_idx4) */ COUNT(time
--4. if drop partition without update global index, the gpi will be invalid, we can rebuild the index
ALTER TABLE range_list_sales1 DROP PARTITION FOR (1600);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
EXPLAIN(costs off) SELECT /*+ indexonlyscan(range_list_sales1 range_list_sales1_idx1) */ COUNT(product_id) FROM range_list_sales1;
WARNING: Error hint: IndexOnlyScan(range_list_sales1 range_list_sales1_idx1), index "range_list_sales1_idx1" doesn't exist.
QUERY PLAN
@ -344,6 +345,7 @@ SELECT /*+ indexonlyscan(range_list_sales1 range_list_sales1_idx4) */ COUNT(time
--5. if drop subpartition without update global index, the gpi will be invalid, we can rebuild the index
ALTER TABLE range_list_sales1 DROP SUBPARTITION customer5_channel3;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
EXPLAIN(costs off) SELECT /*+ indexonlyscan(range_list_sales1 range_list_sales1_idx1) */ COUNT(product_id) FROM range_list_sales1;
WARNING: Error hint: IndexOnlyScan(range_list_sales1 range_list_sales1_idx1), index "range_list_sales1_idx1" doesn't exist.
QUERY PLAN

View File

@ -454,6 +454,7 @@ select * from range_list where user_no = '1' order by 1, 2, 3, 4;
(3 rows)
alter table range_list truncate subpartition p_201901_b;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
explain(costs off, verbose on) select * from range_list where month_code = '201902' order by 1, 2, 3, 4;
QUERY PLAN
----------------------------------------------------------------------------------
@ -721,6 +722,7 @@ alter table range_list split subpartition p_201902_b values ('3') into
subpartition p_201902_b,
subpartition p_201902_c
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
explain(costs off, verbose on) select * from range_list where month_code = '201902' order by 1, 2, 3, 4;
QUERY PLAN
----------------------------------------------------------------------------------
@ -995,6 +997,7 @@ alter table range_range split subpartition p_201902_b at ('3') into
subpartition p_201902_c,
subpartition p_201903_d
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
explain(costs off, verbose on) select * from range_range where month_code = '201902' order by 1, 2, 3, 4;
QUERY PLAN
-----------------------------------------------------------------------------------

View File

@ -60,6 +60,7 @@ alter table list_list split subpartition p_201901_b values (2) into
subpartition p_201901_b,
subpartition p_201901_c
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201901_a) order by 1,2,3,4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -104,6 +105,7 @@ alter table list_list split subpartition p_201902_b values (2, 3) into
subpartition p_201902_b,
subpartition p_201902_c
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201902_a) order by 1,2,3,4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -186,6 +188,7 @@ alter table range_range split subpartition p_201901_b at (3) into
subpartition p_201901_c,
subpartition p_201901_d
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from range_range subpartition (p_201901_a) order by 1,2,3,4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -224,6 +227,7 @@ alter table range_range split subpartition p_201902_b at (3) into
subpartition p_201902_c,
subpartition p_201902_d
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from range_range subpartition (p_201902_a) order by 1,2,3,4;
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------

View File

@ -50,6 +50,7 @@ select * from list_list partition (p_201901);
(3 rows)
alter table list_list truncate partition p_201901;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list partition (p_201901);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -64,6 +65,7 @@ select * from list_list partition (p_201902);
(3 rows)
alter table list_list truncate partition p_201902;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list partition (p_201902);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -88,6 +90,7 @@ select * from list_list subpartition (p_201901_a);
(2 rows)
alter table list_list truncate subpartition p_201901_a;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201901_a);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -100,6 +103,7 @@ select * from list_list subpartition (p_201901_b);
(1 row)
alter table list_list truncate subpartition p_201901_b;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201901_b);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -112,6 +116,7 @@ select * from list_list subpartition (p_201902_a);
(1 row)
alter table list_list truncate subpartition p_201902_a;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201902_a);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -125,6 +130,7 @@ select * from list_list subpartition (p_201902_b);
(2 rows)
alter table list_list truncate subpartition p_201902_b;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201902_b);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------

View File

@ -50,6 +50,7 @@ select * from list_list partition (p_201901);
(3 rows)
alter table list_list truncate partition p_201901;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list partition (p_201901);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -64,6 +65,7 @@ select * from list_list partition (p_201902);
(3 rows)
alter table list_list truncate partition p_201902;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list partition (p_201902);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -88,6 +90,7 @@ select * from list_list subpartition (p_201901_a);
(2 rows)
alter table list_list truncate subpartition p_201901_a;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201901_a);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -100,6 +103,7 @@ select * from list_list subpartition (p_201901_b);
(1 row)
alter table list_list truncate subpartition p_201901_b;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201901_b);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -112,6 +116,7 @@ select * from list_list subpartition (p_201902_a);
(1 row)
alter table list_list truncate subpartition p_201902_a;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201902_a);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------
@ -125,6 +130,7 @@ select * from list_list subpartition (p_201902_b);
(2 rows)
alter table list_list truncate subpartition p_201902_b;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from list_list subpartition (p_201902_b);
month_code | dept_code | user_no | sales_amt
------------+-----------+---------+-----------

View File

@ -222,6 +222,7 @@ select count(*) from cstore_part_table where c3 < 5;
(1 row)
alter table cstore_part_table truncate partition cstore_part_table_p0;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(*) from cstore_part_table where c3 < 5;
count
-------
@ -455,6 +456,7 @@ select * from cstore_part_table order by c1,c3;
(10 rows)
alter table cstore_part_table truncate partition cstore_part_table_p4;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from cstore_part_table partition (cstore_part_table_p4);
c3 | c1
----+----
@ -476,6 +478,7 @@ alter table ord_table add column c1 text default 100;
alter table ord_table drop column c2;
insert into ord_table(c1,c3) values(generate_series(1,6),generate_series(1,6));
alter table cstore_part_table exchange partition(cstore_part_table_p4) with table ord_table with validation;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from cstore_part_table partition (cstore_part_table_p4) order by c3;
c3 | c1
----+----

View File

@ -234,6 +234,7 @@ create table test_exchange_row(id int, value int);
insert into test_exchange_row values(1, generate_series(10, 19));
insert into test_exchange_col select * from test_exchange_row;
alter table test_exchange_partition exchange partition (p2) with table test_exchange_col;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(1) from test_exchange_partition;
count
-------
@ -248,6 +249,7 @@ insert into test_exchange_col select * from test_exchange_row;
alter table test_exchange_partition exchange partition (p2) with table test_exchange_col with validation;
ERROR: some rows in table do not qualify for specified partition
alter table test_exchange_partition exchange partition (p2) with table test_exchange_col with validation verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select count(1) from test_exchange_partition;
count
-------

View File

@ -22,6 +22,7 @@ select * from test_exchange_func_ht;
(1 row)
alter table test_exchange_func_ht exchange partition (p2) with table test_exchange_func_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ord;
a
---
@ -93,6 +94,7 @@ select * from test_exchange_func_ht partition for (1);
(1 row)
alter table test_exchange_func_ht exchange partition for (1) with table test_exchange_func_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ht partition for (1);
a
---
@ -310,6 +312,7 @@ partition by hash(a)
PARTITION p2
);
alter table test_exchange_constraint_ht exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_ht;
--a-2
@ -347,6 +350,7 @@ partition by hash(a)
PARTITION p2
);
alter table test_exchange_constraint_ht exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_ht;
--a-4-2
@ -371,6 +375,7 @@ partition by hash(a)
PARTITION p2
);
alter table test_exchange_constraint_ht exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_ht;
--b-2
@ -398,6 +403,7 @@ partition by hash(a)
);
NOTICE: CREATE TABLE / UNIQUE will create implicit index "test_exchange_constraint_ht_a_key" for table "test_exchange_constraint_ht"
alter table test_exchange_constraint_ht exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_ht;
--c-2
@ -426,6 +432,7 @@ partition by hash(a)
);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "test_exchange_constraint_ht_pkey" for table "test_exchange_constraint_ht"
alter table test_exchange_constraint_ht exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_ht;
--d-2
@ -454,6 +461,7 @@ partition by hash(a)
PARTITION p2
);
alter table test_exchange_constraint_ht exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_ht;
drop table test_exchange_constraint_ref;
@ -499,6 +507,7 @@ partition by hash(a)
PARTITION p2
);
alter table test_exchange_constraint_ht exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_ht;
--f-2
@ -647,6 +656,7 @@ create index test_exchange_index_ht_b on test_exchange_index_ht (b) local;
create index test_exchange_index_ht_a_1 on test_exchange_index_ht (a) local;
create index test_exchange_index_ht_a_2 on test_exchange_index_ht (a) local;
alter table test_exchange_index_ht exchange partition (p1) with table test_exchange_index_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_index_ord;
drop table test_exchange_index_ht;
-- 7. validation check
@ -689,6 +699,7 @@ partition by hash(a)
insert into test_exchange_validation_ord values (1), (10);
--SUCCESS
alter table test_exchange_validation_ht exchange partition (p1) with table test_exchange_validation_ord without validation;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_validation_ord;
drop table test_exchange_validation_ht;
/*
@ -840,6 +851,7 @@ select a from test_exchange_index_ht where a=1;
(1 row)
alter table test_exchange_index_ht exchange partition (p1) with table test_exchange_index_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select a from test_exchange_index_ht partition (p1);
a
---
@ -939,6 +951,7 @@ select p.relname, t.spcname from pg_partition p, pg_tablespace t where p.reltabl
(1 row)
alter table test_exchange_tablespace_ht exchange partition (p1) with table test_exchange_tablespace_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--check tablespace has exchanged
select c.relname, t.spcname from pg_class c, pg_tablespace t where c.reltablespace=t.oid and c.relname='test_exchange_tablespace_ord';
relname | spcname
@ -998,6 +1011,7 @@ select p.relname, t.spcname from pg_partition p, pg_tablespace t where p.reltabl
(1 row)
alter table test_exchange_tablespace_ht exchange partition (p1) with table test_exchange_tablespace_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--check tablespace has exchanged
select c.relname, t.spcname from pg_class c, pg_tablespace t where c.reltablespace=t.oid and c.relname='test_exchange_tablespace_ord_a';
relname | spcname
@ -1028,14 +1042,18 @@ partition by hash(a)
PARTITION test_exchange_verbose_ht_p3
);
alter table test_exchange_verbose_ht exchange partition (test_exchange_verbose_ht_p1) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table test_exchange_verbose_ht exchange partition (test_exchange_verbose_ht_p1) with table test_exchange_verbose_ord with validation verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--ERROR
alter table test_exchange_verbose_ht exchange partition (test_exchange_verbose_ht_p1) with table test_exchange_verbose_ord without validation verbose;
ERROR: syntax error at or near "verbose"
LINE 1: ... table test_exchange_verbose_ord without validation verbose;
^
alter table test_exchange_verbose_ht exchange partition for (5) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table test_exchange_verbose_ht exchange partition for (5) with table test_exchange_verbose_ord with validation verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--ERROR
alter table test_exchange_verbose_ht exchange partition for (5) with table test_exchange_verbose_ord without validation verbose;
ERROR: syntax error at or near "verbose"
@ -1054,6 +1072,7 @@ partition by hash(a)
);
insert into test_exchange_verbose_ord values(generate_series(1, 6));
alter table test_exchange_verbose_ht exchange partition (test_exchange_verbose_ht_p1) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_verbose_ord order by 1;
a
---
@ -1106,6 +1125,7 @@ create index test_exchange_verbose_ord_index on test_exchange_verbose_ord (b);
create index test_exchange_verbose_ht_index on test_exchange_verbose_ht (b) local;
insert into test_exchange_verbose_ord values (-1, generate_series(1, 6));
alter table test_exchange_verbose_ht exchange partition (test_exchange_verbose_ht_p1) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
set enable_seqscan=off;
explain(ANALYZE false,VERBOSE false, COSTS false,BUFFERS false,TIMING false) select b from test_exchange_verbose_ht where b=5;
QUERY PLAN
@ -1134,6 +1154,7 @@ update test_exchange_verbose_ord set b=3 where b=4;
delete from test_exchange_verbose_ord where b=2;
delete from test_exchange_verbose_ord where b=3;
alter table test_exchange_verbose_ht exchange partition (test_exchange_verbose_ht_p1) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
explain(ANALYZE false,VERBOSE false, COSTS false,BUFFERS false,TIMING false) select b from test_exchange_verbose_ht where b=1;
QUERY PLAN
-----------------------------------------------------------------------
@ -1659,6 +1680,7 @@ select * from test_exchange_func_ht partition (p2);
(1 row)
alter table test_exchange_func_ht exchange partition (p1) with table test_exchange_func_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ord;
a
---
@ -1748,6 +1770,7 @@ select * from test_exchange_func_ht partition (p2);
(1 row)
alter table test_exchange_func_ht exchange partition for (3) with table test_exchange_func_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ord;
a
---
@ -1810,9 +1833,13 @@ partition by hash(a)
PARTITION p9
);
alter table test_exchange_func_ht exchange partition (p3) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table test_exchange_func_ht exchange partition (p5) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table test_exchange_func_ht exchange partition (p7) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table test_exchange_func_ht exchange partition (p9) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ht;
a | b | c
---+---+---
@ -1854,12 +1881,14 @@ select * from test_exchange_func_ht partition(p1);
(13 rows)
alter table test_exchange_func_ht exchange partition for (9) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ht partition(p1);
a | b | c
---+---+---
(0 rows)
alter table test_exchange_func_ht exchange partition for (9) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ht partition(p1);
a | b | c
----+---+---
@ -1896,12 +1925,14 @@ select * from test_exchange_func_ht partition(p5);
(12 rows)
alter table test_exchange_func_ht exchange partition for (2) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ht partition(p5);
a | b | c
---+---+---
(0 rows)
alter table test_exchange_func_ht exchange partition for (2) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ht partition(p5);
a | b | c
-----+---+---
@ -1940,12 +1971,14 @@ select * from test_exchange_func_ht partition(p9);
(15 rows)
alter table test_exchange_func_ht exchange partition for (17) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ht partition(p9);
a | b | c
---+---+---
(0 rows)
alter table test_exchange_func_ht exchange partition for (17) with table test_exchange_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ht partition(p9);
a | b | c
----+---+---

View File

@ -122,6 +122,7 @@ select * from interval_normal_date partition (sys_p3) order by logdate;
-- drop range partition which is not next to interval range.
ALTER TABLE interval_normal_date DROP PARTITION interval_normal_date_p2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- see about the info of the partitioned table in pg_partition
select relname, parttype, partstrategy, boundaries from pg_partition
where parentid = (select oid from pg_class where relname = 'interval_normal_date')
@ -138,6 +139,7 @@ select relname, parttype, partstrategy, boundaries from pg_partition
-- drop interval range partition
ALTER TABLE interval_normal_date DROP PARTITION sys_p2;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- see the info of the partitioned table in pg_partition, only reduce a interval range partition instance.
select relname, parttype, partstrategy, boundaries from pg_partition
where parentid = (select oid from pg_class where relname = 'interval_normal_date')
@ -153,6 +155,7 @@ select relname, parttype, partstrategy, boundaries from pg_partition
-- drop range partition which is next to interval range.
ALTER TABLE interval_normal_date DROP PARTITION interval_normal_date_p3;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
-- the interval parttition will changed to range partition
select relname, parttype, partstrategy, boundaries from pg_partition
where parentid = (select oid from pg_class where relname = 'interval_normal_date')
@ -273,6 +276,7 @@ select * from interval_normal_date partition (sys_p6) order by logdate;
--
-- truncate a range partition
ALTER TABLE interval_normal_date truncate PARTITION interval_normal_date_p1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_normal_date partition (interval_normal_date_p1) order by logdate;
logdate
---------
@ -280,6 +284,7 @@ select * from interval_normal_date partition (interval_normal_date_p1) order by
-- truncate a interval partition
ALTER TABLE interval_normal_date truncate PARTITION sys_p4;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from interval_normal_date partition (sys_p4) order by logdate;
logdate
---------
@ -301,6 +306,7 @@ ALTER TABLE interval_normal_date SPLIT PARTITION sys_p1 AT ('2020-04-01 00:00:00
PARTITION sys_p1_1,
PARTITION sys_p1_2
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--
---- add partition is not supported;
--

View File

@ -22,6 +22,7 @@ select * from test_exchange_func_lt;
(1 row)
alter table test_exchange_func_lt exchange partition (p1) with table test_exchange_func_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ord;
a
---
@ -87,6 +88,7 @@ select * from test_exchange_func_lt;
(1 row)
alter table test_exchange_func_lt exchange partition for (1) with table test_exchange_func_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ord;
a
---
@ -301,6 +303,7 @@ partition by list(a)
PARTITION p2 VALUES (3, 4, 5)
);
alter table test_exchange_constraint_lt exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_lt;
--a-2
@ -338,6 +341,7 @@ partition by list(a)
PARTITION p2 VALUES (3, 4, 5)
);
alter table test_exchange_constraint_lt exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_lt;
--a-4-2
@ -362,6 +366,7 @@ partition by list(a)
PARTITION p2 VALUES (3, 4, 5)
);
alter table test_exchange_constraint_lt exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_lt;
--b-2
@ -389,6 +394,7 @@ partition by list(a)
);
NOTICE: CREATE TABLE / UNIQUE will create implicit index "test_exchange_constraint_lt_a_key" for table "test_exchange_constraint_lt"
alter table test_exchange_constraint_lt exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_lt;
--c-2
@ -417,6 +423,7 @@ partition by list(a)
);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "test_exchange_constraint_lt_pkey" for table "test_exchange_constraint_lt"
alter table test_exchange_constraint_lt exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_lt;
--d-2
@ -445,6 +452,7 @@ partition by list(a)
PARTITION p2 VALUES (3, 4, 5)
);
alter table test_exchange_constraint_lt exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_lt;
drop table test_exchange_constraint_ref;
@ -490,6 +498,7 @@ partition by list(a)
PARTITION p2 VALUES (3, 4, 5)
);
alter table test_exchange_constraint_lt exchange partition (p1) with table test_exchange_constraint_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_constraint_ord;
drop table test_exchange_constraint_lt;
--f-2
@ -638,6 +647,7 @@ create index test_exchange_index_lt_b on test_exchange_index_lt (b) local;
create index test_exchange_index_lt_a_1 on test_exchange_index_lt (a) local;
create index test_exchange_index_lt_a_2 on test_exchange_index_lt (a) local;
alter table test_exchange_index_lt exchange partition (p1) with table test_exchange_index_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_index_ord;
drop table test_exchange_index_lt;
-- 7. validation check
@ -680,6 +690,7 @@ partition by list(a)
insert into test_exchange_validation_ord values (1), (10);
--SUCCESS
alter table test_exchange_validation_lt exchange partition (p1) with table test_exchange_validation_ord without validation;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
drop table test_exchange_validation_ord;
drop table test_exchange_validation_lt;
/*
@ -795,6 +806,7 @@ select a from test_exchange_index_ord where a=1;
(0 rows)
alter table test_exchange_index_lt exchange partition (p2) with table test_exchange_index_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
explain(verbose on, costs off) select a from test_exchange_index_ord where a=3;
QUERY PLAN
------------------------------------------------------
@ -856,6 +868,7 @@ select p.relname, t.spcname from pg_partition p, pg_tablespace t where p.reltabl
(1 row)
alter table test_exchange_tablespace_lt exchange partition (p1) with table test_exchange_tablespace_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--check tablespace has exchanged
select c.relname, t.spcname from pg_class c, pg_tablespace t where c.reltablespace=t.oid and c.relname='test_exchange_tablespace_ord';
relname | spcname
@ -915,6 +928,7 @@ select p.relname, t.spcname from pg_partition p, pg_tablespace t where p.reltabl
(1 row)
alter table test_exchange_tablespace_lt exchange partition (p1) with table test_exchange_tablespace_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--check tablespace has exchanged
select c.relname, t.spcname from pg_class c, pg_tablespace t where c.reltablespace=t.oid and c.relname='test_exchange_tablespace_ord_a';
relname | spcname
@ -945,14 +959,18 @@ partition by list(a)
PARTITION test_exchange_verbose_lt_p3 VALUES (5, 6)
);
alter table test_exchange_verbose_lt exchange partition (test_exchange_verbose_lt_p1) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table test_exchange_verbose_lt exchange partition (test_exchange_verbose_lt_p1) with table test_exchange_verbose_ord with validation verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--ERROR
alter table test_exchange_verbose_lt exchange partition (test_exchange_verbose_lt_p1) with table test_exchange_verbose_ord without validation verbose;
ERROR: syntax error at or near "verbose"
LINE 1: ... table test_exchange_verbose_ord without validation verbose;
^
alter table test_exchange_verbose_lt exchange partition for (5) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
alter table test_exchange_verbose_lt exchange partition for (5) with table test_exchange_verbose_ord with validation verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
--ERROR
alter table test_exchange_verbose_lt exchange partition for (5) with table test_exchange_verbose_ord without validation verbose;
ERROR: syntax error at or near "verbose"
@ -971,6 +989,7 @@ partition by list(a)
);
insert into test_exchange_verbose_ord values(generate_series(1, 6));
alter table test_exchange_verbose_lt exchange partition (test_exchange_verbose_lt_p1) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_verbose_ord order by 1;
a
---
@ -1030,6 +1049,7 @@ create index test_exchange_verbose_ord_index on test_exchange_verbose_ord (b);
create index test_exchange_verbose_lt_index on test_exchange_verbose_lt (b) local;
insert into test_exchange_verbose_ord values (-1, generate_series(1, 6));
alter table test_exchange_verbose_lt exchange partition (test_exchange_verbose_lt_p1) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
set enable_seqscan=off;
explain(ANALYZE false,VERBOSE false, COSTS false,BUFFERS false,TIMING false) select b from test_exchange_verbose_lt where b=5;
QUERY PLAN
@ -1058,6 +1078,7 @@ update test_exchange_verbose_ord set b=3 where b=4;
delete from test_exchange_verbose_ord where b=2;
delete from test_exchange_verbose_ord where b=3;
alter table test_exchange_verbose_lt exchange partition (test_exchange_verbose_lt_p1) with table test_exchange_verbose_ord verbose;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
explain(ANALYZE false,VERBOSE false, COSTS false,BUFFERS false,TIMING false) select b from test_exchange_verbose_lt where b=1;
QUERY PLAN
-----------------------------------------------------------------------
@ -1498,6 +1519,7 @@ select * from test_exchange_func_lt;
(1 row)
alter table test_exchange_func_lt exchange partition (p1) with table test_exchange_func_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ord;
a
---
@ -1563,6 +1585,7 @@ select * from test_exchange_func_lt;
(1 row)
alter table test_exchange_func_lt exchange partition for (1) with table test_exchange_func_ord;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from test_exchange_func_ord;
a
---

View File

@ -578,6 +578,7 @@ SELECT pg_catalog.selecthist('ledgernsp', 'partition_table');
--test split partition
ALTER TABLE ledgernsp.partition_table SPLIT PARTITION P4 AT (450) into (PARTITION P5, PARTITION P6);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
INSERT INTO ledgernsp.partition_table VALUES(700, '700');
UPDATE ledgernsp.partition_table SET c = '700c' WHERE a = 700;
DELETE ledgernsp.partition_table WHERE a = 700;
@ -589,6 +590,7 @@ SELECT pg_catalog.selecthist('ledgernsp', 'partition_table');
--test add partition
ALTER TABLE ledgernsp.partition_table SPLIT PARTITION P6 AT (2000) into (PARTITION P7, PARTITION P8);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
ALTER TABLE ledgernsp.partition_table DROP PARTITION P8;
ERROR: Unsupport to ALTER the structure of blockchain related table [partition_table].
ALTER TABLE ledgernsp.partition_table ADD PARTITION P9 VALUES LESS THAN (MAXVALUE);
@ -603,6 +605,7 @@ SELECT pg_catalog.selecthist('ledgernsp', 'partition_table');
--test merge partition
ALTER TABLE ledgernsp.partition_table MERGE PARTITIONS P5,P7 INTO PARTITION P6;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
SELECT pg_catalog.selecthist('ledgernsp', 'partition_table');
selecthist
-------------------------------------------

View File

@ -529,6 +529,7 @@ select pg_sleep(4);
insert into t_timecapsule_test_tmp select 2, now(), int8in(xidout(next_csn)) from gs_get_next_xid_csn();
ALTER TABLE PARTITION_TABLE_001 TRUNCATE PARTITION PARTITION_TABLE_001_1;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from PARTITION_TABLE_001 timecapsule csn findCsn(2);
ERROR: The table definition of "partition_table_001" has been changed.
select pg_sleep(4);
@ -540,6 +541,7 @@ select pg_sleep(4);
insert into t_timecapsule_test_tmp select 3, now(), int8in(xidout(next_csn)) from gs_get_next_xid_csn();
ALTER TABLE PARTITION_TABLE_001 MERGE PARTITIONS PARTITION_TABLE_001_1,PARTITION_TABLE_001_2 INTO PARTITION PARTITION_TABLE_001_6;
--?CONTEXT: SQL statement "NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pg_tmp.*" for table "pg_temp.*"
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from PARTITION_TABLE_001 timecapsule csn findCsn(3);
ERROR: The table definition of "partition_table_001" has been changed.
select pg_sleep(4);
@ -553,6 +555,7 @@ alter table PARTITION_TABLE_001 split PARTITION PARTITION_TABLE_001_5 into (
partition PARTITION_TABLE_001_5_1 values less than (80,80,900,900.2),
partition PARTITION_TABLE_001_5_2 values less than (100,100,1000,1100.2)
);
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from PARTITION_TABLE_001 timecapsule csn findCsn(4);
ERROR: The table definition of "partition_table_001" has been changed.
select pg_sleep(4);
@ -573,6 +576,7 @@ select pg_sleep(4);
insert into t_timecapsule_test_tmp select 6, now(), int8in(xidout(next_csn)) from gs_get_next_xid_csn();
ALTER TABLE PARTITION_TABLE_001 DROP PARTITION PARTITION_TABLE_001_4;
NOTICE: Command without UPDATE GLOBAL INDEX will disable global index
select * from PARTITION_TABLE_001 timecapsule csn findCsn(6);
ERROR: The table definition of "partition_table_001" has been changed.
select pg_sleep(4);