diff --git a/hw_partition_interval_exchange.out b/hw_partition_interval_exchange.out deleted file mode 100644 index ecfa36185..000000000 --- a/hw_partition_interval_exchange.out +++ /dev/null @@ -1,321 +0,0 @@ --- --- Test exchange operator for interval partitioned table --- --- ----- create interval partitioned table --- -CREATE TABLE interval_normal_exchange (logdate date not null) -PARTITION BY RANGE (logdate) -INTERVAL ('1 month') -( - PARTITION interval_normal_exchange_p1 VALUES LESS THAN ('2020-03-01'), - PARTITION interval_normal_exchange_p2 VALUES LESS THAN ('2020-04-01'), - PARTITION interval_normal_exchange_p3 VALUES LESS THAN ('2020-05-01') -); --- 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_exchange') - order by relname; - relname | parttype | partstrategy | boundaries ------------------------------+----------+--------------+-------------- - interval_normal_exchange | r | i | - interval_normal_exchange_p1 | p | r | {2020-03-01} - interval_normal_exchange_p2 | p | r | {2020-04-01} - interval_normal_exchange_p3 | p | r | {2020-05-01} -(4 rows) - --- insert the record that is smaller than the lower boundary -insert into interval_normal_exchange values ('2020-02-21'); -insert into interval_normal_exchange values ('2020-02-22'); -insert into interval_normal_exchange values ('2020-02-23'); -insert into interval_normal_exchange values ('2020-5-01'); -insert into interval_normal_exchange values ('2020-5-02'); -insert into interval_normal_exchange values ('2020-5-03'); --- 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_exchange') - order by relname; - relname | parttype | partstrategy | boundaries ------------------------------+----------+--------------+------------------------------ - interval_normal_exchange | r | i | - interval_normal_exchange_p1 | p | r | {2020-03-01} - interval_normal_exchange_p2 | p | r | {2020-04-01} - interval_normal_exchange_p3 | p | r | {2020-05-01} - sys_p1 | p | i | {"Mon Jun 01 00:00:00 2020"} -(5 rows) - --- ----- create to be exchanged table and test range partition exchange --- -CREATE TABLE interval_exchange_test (logdate date not null); -insert into interval_exchange_test values ('2020-02-24'); -insert into interval_exchange_test values ('2020-02-25'); -insert into interval_exchange_test values ('2020-02-26'); --- do exchange partition interval_normal_exchange_p1 and interval_exchange_test --- 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; -select * from interval_normal_exchange partition (interval_normal_exchange_p1)order by logdate; - logdate --------------------------- - Mon Feb 24 00:00:00 2020 - Tue Feb 25 00:00:00 2020 - Wed Feb 26 00:00:00 2020 -(3 rows) - -select * from interval_exchange_test order by logdate; - logdate --------------------------- - Fri Feb 21 00:00:00 2020 - Sat Feb 22 00:00:00 2020 - Sun Feb 23 00:00:00 2020 -(3 rows) - --- exchange back -ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (interval_normal_exchange_p1) - WITH TABLE interval_exchange_test; -select * from interval_normal_exchange partition (interval_normal_exchange_p1)order by logdate; - logdate --------------------------- - Fri Feb 21 00:00:00 2020 - Sat Feb 22 00:00:00 2020 - Sun Feb 23 00:00:00 2020 -(3 rows) - -select * from interval_exchange_test order by logdate; - logdate --------------------------- - Mon Feb 24 00:00:00 2020 - Tue Feb 25 00:00:00 2020 - Wed Feb 26 00:00:00 2020 -(3 rows) - --- Insert a new record not belongs to interval_normal_exchange_p1 -insert into interval_exchange_test values ('2020-3-05'); --- defaut is WITH VALIDATION, and the exchange will be failed -ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (interval_normal_exchange_p1) - WITH TABLE interval_exchange_test; -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; -select * from interval_normal_exchange partition (interval_normal_exchange_p1)order by logdate; - logdate --------------------------- - Mon Feb 24 00:00:00 2020 - Tue Feb 25 00:00:00 2020 - Wed Feb 26 00:00:00 2020 - Thu Mar 05 00:00:00 2020 -(4 rows) - -select * from interval_exchange_test order by logdate; - logdate --------------------------- - Fri Feb 21 00:00:00 2020 - Sat Feb 22 00:00:00 2020 - Sun Feb 23 00:00:00 2020 -(3 rows) - --- not include '2020-3-05' -select * from interval_normal_exchange where logdate > '2020-03-01' order by logdate; - logdate --------------------------- - Fri May 01 00:00:00 2020 - Sat May 02 00:00:00 2020 - Sun May 03 00:00:00 2020 -(3 rows) - --- ----- clean the data and test interval partition exchange --- -truncate table interval_exchange_test; -insert into interval_exchange_test values ('2020-5-04'); -insert into interval_exchange_test values ('2020-5-05'); -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; -select * from interval_normal_exchange partition (sys_p1)order by logdate; - logdate --------------------------- - Mon May 04 00:00:00 2020 - Tue May 05 00:00:00 2020 - Wed May 06 00:00:00 2020 -(3 rows) - -select * from interval_exchange_test order by logdate; - logdate --------------------------- - Fri May 01 00:00:00 2020 - Sat May 02 00:00:00 2020 - Sun May 03 00:00:00 2020 -(3 rows) - --- exchange back -ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (sys_p1) - WITH TABLE interval_exchange_test; -select * from interval_normal_exchange partition (sys_p1)order by logdate; - logdate --------------------------- - Fri May 01 00:00:00 2020 - Sat May 02 00:00:00 2020 - Sun May 03 00:00:00 2020 -(3 rows) - -select * from interval_exchange_test order by logdate; - logdate --------------------------- - Mon May 04 00:00:00 2020 - Tue May 05 00:00:00 2020 - Wed May 06 00:00:00 2020 -(3 rows) - -insert into interval_exchange_test values ('2020-6-05'); --- defaut is WITH VALIDATION, and the exchange will be failed -ALTER TABLE interval_normal_exchange EXCHANGE PARTITION (interval_normal_exchange_p1) - WITH TABLE interval_exchange_test; -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; -select * from interval_normal_exchange partition (interval_normal_exchange_p1)order by logdate; - logdate --------------------------- - Mon May 04 00:00:00 2020 - Tue May 05 00:00:00 2020 - Wed May 06 00:00:00 2020 - Fri Jun 05 00:00:00 2020 -(4 rows) - -select * from interval_exchange_test order by logdate; - logdate --------------------------- - Mon Feb 24 00:00:00 2020 - Tue Feb 25 00:00:00 2020 - Wed Feb 26 00:00:00 2020 - Thu Mar 05 00:00:00 2020 -(4 rows) - --- not include '2020-6-05' -select * from interval_normal_exchange order by logdate; - logdate --------------------------- - Fri May 01 00:00:00 2020 - Sat May 02 00:00:00 2020 - Sun May 03 00:00:00 2020 - Mon May 04 00:00:00 2020 - Tue May 05 00:00:00 2020 - Wed May 06 00:00:00 2020 - Fri Jun 05 00:00:00 2020 -(7 rows) - -select * from interval_normal_exchange where logdate > '2020-06-01' order by logdate; - logdate ---------- -(0 rows) - -drop table interval_normal_exchange; -drop table table_001; -ERROR: table "table_001" does not exist -create table table_001( - COL_1 smallint, - COL_2 char(5), - COL_3 int, - COL_4 date, - COL_5 boolean, - COL_6 nchar(5), - COL_7 float - ); -drop table partition_table_001; -ERROR: table "partition_table_001" does not exist -create table partition_table_001( - COL_1 smallint, - COL_2 char(5), - COL_3 int, - COL_4 date, - COL_5 boolean, - COL_6 nchar(5), - COL_7 float - ) - PARTITION BY RANGE (COL_4) - INTERVAL ('1 month') - ( - PARTITION partition_table_001_p1 VALUES LESS THAN ('2020-03-01'), - PARTITION partition_table_001_p2 VALUES LESS THAN ('2020-04-01'), - PARTITION partition_table_001_p3 VALUES LESS THAN ('2020-05-01') - ); -insert into partition_table_001 values (1,'aaa',1,'2020-02-23',true,'aaa',1.1); -insert into partition_table_001 values (2,'bbb',2,'2020-03-23',false,'bbb',2.2); -insert into partition_table_001 values (3,'ccc',3,'2020-04-23',true,'ccc',3.3); -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; -select * from table_001 order by 1; - col_1 | col_2 | col_3 | col_4 | col_5 | col_6 | col_7 --------+-------+-------+--------------------------+-------+-------+------- - 4 | ddd | 4 | Sat May 23 00:00:00 2020 | f | ddd | 4.4 -(1 row) - -select * from partition_table_001 order by 1; - col_1 | col_2 | col_3 | col_4 | col_5 | col_6 | col_7 --------+-------+-------+--------------------------+-------+-------+------- - 1 | aaa | 1 | Sun Feb 23 00:00:00 2020 | t | aaa | 1.1 - 2 | bbb | 2 | Mon Mar 23 00:00:00 2020 | f | bbb | 2.2 - 3 | ccc | 3 | Thu Apr 23 00:00:00 2020 | t | ccc | 3.3 - 5 | eee | 5 | Tue Jun 23 00:00:00 2020 | t | eee | 5.5 - 6 | fff | 6 | Thu Jul 23 00:00:00 2020 | f | fff | 6.6 -(5 rows) - -select relname, parttype, partstrategy, boundaries from pg_partition - where parentid = (select oid from pg_class where relname = 'partition_table_001') - order by relname; - relname | parttype | partstrategy | boundaries -------------------------+----------+--------------+------------------------------ - partition_table_001 | r | i | - partition_table_001_p1 | p | r | {2020-03-01} - partition_table_001_p2 | p | r | {2020-04-01} - partition_table_001_p3 | p | r | {2020-05-01} - sys_p1 | p | i | {"Mon Jun 01 00:00:00 2020"} - sys_p2 | p | i | {"Wed Jul 01 00:00:00 2020"} - sys_p3 | p | i | {"Sat Aug 01 00:00:00 2020"} -(7 rows) - -ALTER TABLE partition_table_001 EXCHANGE PARTITION (sys_p1) WITH TABLE table_001; -select * from table_001 order by 1; - col_1 | col_2 | col_3 | col_4 | col_5 | col_6 | col_7 --------+-------+-------+-------+-------+-------+------- -(0 rows) - -select * from partition_table_001 order by 1; - col_1 | col_2 | col_3 | col_4 | col_5 | col_6 | col_7 --------+-------+-------+--------------------------+-------+-------+------- - 1 | aaa | 1 | Sun Feb 23 00:00:00 2020 | t | aaa | 1.1 - 2 | bbb | 2 | Mon Mar 23 00:00:00 2020 | f | bbb | 2.2 - 3 | ccc | 3 | Thu Apr 23 00:00:00 2020 | t | ccc | 3.3 - 4 | ddd | 4 | Sat May 23 00:00:00 2020 | f | ddd | 4.4 - 5 | eee | 5 | Tue Jun 23 00:00:00 2020 | t | eee | 5.5 - 6 | fff | 6 | Thu Jul 23 00:00:00 2020 | f | fff | 6.6 -(6 rows) - -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; -select * from table_001 order by 1; - col_1 | col_2 | col_3 | col_4 | col_5 | col_6 | col_7 --------+-------+-------+--------------------------+-------+-------+------- - 4 | ddd | 4 | Sat May 23 00:00:00 2020 | f | ddd | 4.4 -(1 row) - -select * from partition_table_001 order by 1; - col_1 | col_2 | col_3 | col_4 | col_5 | col_6 | col_7 --------+-------+-------+--------------------------+-------+-------+------- - 1 | aaa | 1 | Sun Feb 23 00:00:00 2020 | t | aaa | 1.1 - 2 | bbb | 2 | Mon Mar 23 00:00:00 2020 | f | bbb | 2.2 - 3 | ccc | 3 | Thu Apr 23 00:00:00 2020 | t | ccc | 3.3 - 5 | eee | 5 | Tue Jun 23 00:00:00 2020 | t | eee | 5.5 - 6 | fff | 6 | Thu Jul 23 00:00:00 2020 | f | fff | 6.6 - 7 | eee | 7 | Sun Aug 23 00:00:00 2020 | t | eee | 7.7 -(6 rows) - -drop table table_001; -drop table partition_table_001; diff --git a/src/gausskernel/storage/access/transam/xlogfuncs.cpp b/src/gausskernel/storage/access/transam/xlogfuncs.cpp index e96cc7781..20e991e1a 100755 --- a/src/gausskernel/storage/access/transam/xlogfuncs.cpp +++ b/src/gausskernel/storage/access/transam/xlogfuncs.cpp @@ -319,6 +319,10 @@ Datum pg_stop_backup_v2(PG_FUNCTION_ARGS) */ Datum gs_roach_stop_backup(PG_FUNCTION_ARGS) { +#ifndef ROACH_COMMON + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("Un-supported feature"), + errdetail("unsupported function: gs_roach_stop_backup"))); +#endif text *backupid = PG_GETARG_TEXT_P(0); char *backupidstr = NULL; XLogRecPtr stoppoint; @@ -378,6 +382,10 @@ Datum pg_switch_xlog(PG_FUNCTION_ARGS) */ Datum gs_roach_switch_xlog(PG_FUNCTION_ARGS) { +#ifndef ROACH_COMMON + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("Un-supported feature"), + errdetail("unsupported function: gs_roach_switch_xlog"))); +#endif bool request_ckpt = PG_GETARG_BOOL(0); XLogRecPtr switchpoint; @@ -991,6 +999,10 @@ Datum pg_disable_delay_ddl_recycle(PG_FUNCTION_ARGS) Datum gs_roach_enable_delay_ddl_recycle(PG_FUNCTION_ARGS) { +#ifndef ROACH_COMMON + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("Un-supported feature"), + errdetail("unsupported function: gs_roach_enable_delay_ddl_recycle"))); +#endif Name name = PG_GETARG_NAME(0); XLogRecPtr start_lsn; char location[MAXFNAMELEN]; @@ -1010,6 +1022,10 @@ Datum gs_roach_enable_delay_ddl_recycle(PG_FUNCTION_ARGS) Datum gs_roach_disable_delay_ddl_recycle(PG_FUNCTION_ARGS) { +#ifndef ROACH_COMMON + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("Un-supported feature"), + errdetail("unsupported function: gs_roach_disable_delay_ddl_recycle"))); +#endif Name name = PG_GETARG_NAME(0); XLogRecPtr start_lsn; XLogRecPtr end_lsn; diff --git a/src/test/regress/expected/unsupported_features.out b/src/test/regress/expected/unsupported_features.out index 466e8e767..7928ad116 100644 --- a/src/test/regress/expected/unsupported_features.out +++ b/src/test/regress/expected/unsupported_features.out @@ -189,3 +189,20 @@ ERROR: name no such label found drop table tab; reset current_schema; drop schema create_resource CASCADE; +-- roach function +select gs_roach_stop_backup('test'); +ERROR: Un-supported feature +DETAIL: unsupported function: gs_roach_stop_backup +CONTEXT: referenced column: gs_roach_stop_backup +select gs_roach_switch_xlog(false); +ERROR: Un-supported feature +DETAIL: unsupported function: gs_roach_switch_xlog +CONTEXT: referenced column: gs_roach_switch_xlog +select gs_roach_enable_delay_ddl_recycle('test'); +ERROR: Un-supported feature +DETAIL: unsupported function: gs_roach_enable_delay_ddl_recycle +CONTEXT: referenced column: gs_roach_enable_delay_ddl_recycle +select gs_roach_disable_delay_ddl_recycle('test'); +ERROR: Un-supported feature +DETAIL: unsupported function: gs_roach_disable_delay_ddl_recycle +CONTEXT: referenced column: gs_roach_disable_delay_ddl_recycle diff --git a/src/test/regress/sql/unsupported_features.sql b/src/test/regress/sql/unsupported_features.sql index b3e8d8644..e8d740749 100644 --- a/src/test/regress/sql/unsupported_features.sql +++ b/src/test/regress/sql/unsupported_features.sql @@ -112,4 +112,10 @@ alter resource label name add column(tab.a); drop table tab; reset current_schema; -drop schema create_resource CASCADE; \ No newline at end of file +drop schema create_resource CASCADE; + +-- roach function +select gs_roach_stop_backup('test'); +select gs_roach_switch_xlog(false); +select gs_roach_enable_delay_ddl_recycle('test'); +select gs_roach_disable_delay_ddl_recycle('test'); \ No newline at end of file