diff --git a/src/test/regress/input/hw_cstore_tablespace.source b/src/test/regress/input/hw_cstore_tablespace.source deleted file mode 100644 index 95ed568de..000000000 --- a/src/test/regress/input/hw_cstore_tablespace.source +++ /dev/null @@ -1,436 +0,0 @@ -\! rm -fr '@testtablespace@/hw_cstore_tablespace' -\! mkdir '@testtablespace@/hw_cstore_tablespace' - -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace' MAXSIZE 'UNLIMITEDxxx'; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -create table cst1 (a int, b float, c text) with(orientation=column) tablespace hw_cstore_tablespace; -drop table cst1; --- drop tablespace hw_cstore_tablespace; - --- 1. Column Ordinary table + Index table -CREATE TABLE set_tblspc_lineitem -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = column) tablespace hw_cstore_tablespace; -COPY set_tblspc_lineitem FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; -create index idx3_set_tblspc_lineitem on set_tblspc_lineitem(L_LINENUMBER, L_SHIPDATE) tablespace hw_cstore_tablespace; --- 1.1 SET TABLESPACE for column table -ALTER TABLE set_tblspc_lineitem SET TABLESPACE pg_default; --- 1.2 SET TABLESPACE for psort index -ALTER INDEX idx3_set_tblspc_lineitem SET TABLESPACE pg_default; --- 1.3 tablespace is empty, so drop it for testing -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 1.4 Set Tablespace + Add column + Set datatype -ALTER TABLE set_tblspc_lineitem ADD COLUMN c18 int default 100, ALTER COLUMN L_DISCOUNT SET DATA TYPE char(32), SET TABLESPACE hw_cstore_tablespace; -drop tablespace hw_cstore_tablespace; -ALTER TABLE set_tblspc_lineitem SET TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 1.5 DROP/SET not null -alter table set_tblspc_lineitem alter column L_PARTKEY drop not null; -alter table set_tblspc_lineitem alter column L_PARTKEY set not null; --- 1.6 whole deleted CU -DELETE FROM set_tblspc_lineitem; -ALTER TABLE set_tblspc_lineitem SET TABLESPACE hw_cstore_tablespace; -ALTER TABLE set_tblspc_lineitem SET TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 1.7 rollback -START TRANSACTION; -ALTER TABLE set_tblspc_lineitem SET TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -START TRANSACTION; -ALTER TABLE set_tblspc_lineitem ADD COLUMN c19 int default 1000, SET TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -START TRANSACTION; -ALTER INDEX idx3_set_tblspc_lineitem SET TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 1.8 test drop table -ALTER TABLE idx3_set_tblspc_lineitem SET TABLESPACE hw_cstore_tablespace; -drop table set_tblspc_lineitem; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 2. Column Partitioned Table + Index Table -CREATE TABLE set_tblspc_lineitem2 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = column) -partition by range(L_ORDERKEY) -( -partition p1 values less than(100000) tablespace hw_cstore_tablespace, -partition p2 values less than(200000), -partition p3 values less than(300000), -partition p4 values less than (100000000) -); -COPY set_tblspc_lineitem2 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; -create index idx3_set_tblspc_lineitem2 on set_tblspc_lineitem2(L_LINENUMBER) local; --- 2.1 SET TABLESPACE for partitioned table (heap) -ALTER TABLE set_tblspc_lineitem2 SET TABLESPACE hw_cstore_tablespace; -ALTER TABLE set_tblspc_lineitem2 ADD COLUMN c18 int default 100, ALTER COLUMN L_DISCOUNT SET DATA TYPE char(32), SET TABLESPACE hw_cstore_tablespace; --- 2.2 SET TABLESPACE for one partition (heap) -ALTER TABLE set_tblspc_lineitem2 MOVE PARTITION p1 TABLESPACE pg_default, MOVE PARTITION p2 TABLESPACE hw_cstore_tablespace; -ALTER TABLE set_tblspc_lineitem2 MOVE PARTITION p1 TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 2.3 SET TABLESPACE for partitioned table (index) -ALTER INDEX idx3_set_tblspc_lineitem2 SET TABLESPACE pg_default; --- 2.4 SET TABLESPACE for one partition (index) -ALTER INDEX idx3_set_tblspc_lineitem2 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace; -drop tablespace hw_cstore_tablespace; -ALTER INDEX idx3_set_tblspc_lineitem2 MOVE PARTITION p1_l_linenumber_idx TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 2.5 rollback -START TRANSACTION; -ALTER TABLE set_tblspc_lineitem2 MOVE PARTITION p1 TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -START TRANSACTION; -ALTER INDEX idx3_set_tblspc_lineitem2 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 2.6 drop table -ALTER TABLE set_tblspc_lineitem2 MOVE PARTITION p1 TABLESPACE hw_cstore_tablespace; -ALTER INDEX idx3_set_tblspc_lineitem2 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace; -drop table set_tblspc_lineitem2; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 3 test internal mask -create table t_hw_cstore_tablespace(c_int int,c_tsvector tsvector,c_tsquery tsquery); -create index idx_1t_hw_cstore_tablespace on t_hw_cstore_tablespace using gist(c_tsvector); -create index idx_2t_hw_cstore_tablespace on t_hw_cstore_tablespace using gin(c_tsvector); -alter index idx_1t_hw_cstore_tablespace reset(fillfactor); -alter index idx_2t_hw_cstore_tablespace set (fastupdate=false); --- 4. test temp table -CREATE TABLE set_tblspc_lineitem3 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = column) tablespace hw_cstore_tablespace; -COPY set_tblspc_lineitem3 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; -create index idx3_set_tblspc_lineitem3 on set_tblspc_lineitem3(L_LINENUMBER) tablespace hw_cstore_tablespace; -ALTER TABLE set_tblspc_lineitem3 SET TABLESPACE pg_default; -ALTER index idx3_set_tblspc_lineitem3 SET TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); -drop tablespace hw_cstore_tablespace; -drop table set_tblspc_lineitem3; --- 5. test relfilenode.spcNode --- 5.1 test partitioned table -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -CREATE TABLE test_cstore_tablespace01(id int, info text) with(orientation=column) -partition by range(id) -( -partition p1 values less than(5) tablespace hw_cstore_tablespace, -partition p2 values less than(10) -); -INSERT INTO test_cstore_tablespace01 values(-10), (-9), (-7), (0), (1), (2), (3), (4); -VACUUM FULL test_cstore_tablespace01 partition (p1); --- rewrite this table and test tablespace oid valid. -ALTER TABLE test_cstore_tablespace01 ADD COLUMN c_char char(5); -SELECT * FROM test_cstore_tablespace01 partition (p1) ORDER BY 1; -DROP TABLE test_cstore_tablespace01; --- 5.2 test ordinary table -CREATE TABLE test_cstore_tablespace02(id int, info text) with(orientation=column) tablespace hw_cstore_tablespace; -INSERT INTO test_cstore_tablespace02 values(-10), (-9), (-7), (0), (1), (2), (3), (4); -VACUUM FULL test_cstore_tablespace02; --- rewrite this table and test tablespace oid valid. -ALTER TABLE test_cstore_tablespace02 ADD COLUMN c_char char(5), set tablespace pg_default; -SELECT * FROM test_cstore_tablespace02 ORDER BY 1; -DROP TABLE test_cstore_tablespace02; --- 5.3 test failed Assert() -create table test_cstore_tablespace03( -id int, -info text -) -- row relation -partition by range(id) -( -partition p1 values less than(3000) tablespace pg_default, -partition p2 values less than(6000), -partition p3 values less than(maxvalue) -); -insert into test_cstore_tablespace03 values(generate_series(1,10000),generate_series(1,10000)||'python GaussUpgrade.py -t full-upgrade -l ./new.log'); --- 5.3.1 Add Column Quickly, so rewrite is false and lock is 8. And Assert() fails. -alter table test_cstore_tablespace03 move partition p1 tablespace hw_cstore_tablespace, add column c_char2 char(5); --- check data right -SELECT COUNT(*) FROM test_cstore_tablespace03; -DROP TABLE test_cstore_tablespace03; --- 6. temp table --- 6.1 row temp table -CREATE TEMP TABLE set_tblspc_temp_lineitem1 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = row) tablespace hw_cstore_tablespace; -COPY set_tblspc_temp_lineitem1 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; -ALTER TABLE set_tblspc_temp_lineitem1 SET TABLESPACE pg_default; -SELECT reltablespace FROM pg_class WHERE relname = 'set_tblspc_temp_lineitem1'; -- 0 --- 6.5 row temp index -CREATE INDEX idx3_set_tblspc_temp_lineitem1 ON set_tblspc_temp_lineitem1(L_LINENUMBER) tablespace hw_cstore_tablespace; -ALTER INDEX idx3_set_tblspc_temp_lineitem1 SET TABLESPACE pg_default; -SELECT reltablespace FROM pg_class WHERE relname = 'idx3_set_tblspc_temp_lineitem1'; -- 0 --- 6.2 column temp table -CREATE TEMP TABLE set_tblspc_temp_lineitem2 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = column) tablespace hw_cstore_tablespace; -INSERT INTO set_tblspc_temp_lineitem2 SELECT * FROM set_tblspc_temp_lineitem1; -ALTER TABLE set_tblspc_temp_lineitem2 SET TABLESPACE pg_default; -SELECT reltablespace FROM pg_class WHERE relname = 'set_tblspc_temp_lineitem2'; -- 0 --- 6.6 column temp index -CREATE INDEX idx3_set_tblspc_temp_lineitem2 ON set_tblspc_temp_lineitem2(L_LINENUMBER) tablespace hw_cstore_tablespace; -ALTER INDEX idx3_set_tblspc_temp_lineitem2 SET TABLESPACE pg_default; -SELECT reltablespace FROM pg_class WHERE relname = 'idx3_set_tblspc_temp_lineitem2'; -- 0 --- 6.3 row temp partition -CREATE TEMP TABLE set_tblspc_temp_lineitem3 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) with (orientation = row) partition by range(L_PARTKEY) -( -partition p1 values less than(0) , -partition p2 values less than(10) tablespace hw_cstore_tablespace, -partition p3 values less than(20), -partition p4 values less than(maxvalue) -); -- ERROR --- 6.4 column temp partition -CREATE TEMP TABLE set_tblspc_temp_lineitem3 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) with (orientation = column) partition by range(L_PARTKEY) -( -partition p1 values less than(0) , -partition p2 values less than(10) tablespace hw_cstore_tablespace, -partition p3 values less than(20), -partition p4 values less than(maxvalue) -); -- ERROR --- 6.7 row temp index partition --- 6.8 column temp index partition -CREATE TABLE set_tblspc_temp_lineitem3 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) with (orientation = row) partition by range(L_PARTKEY) -( -partition p1 values less than(0) , -partition p2 values less than(10) tablespace hw_cstore_tablespace, -partition p3 values less than(20), -partition p4 values less than(maxvalue) -); -CREATE TEMP INDEX idx_set_tblspc_temp_lineitem3 ON set_tblspc_temp_lineitem3(L_PARTKEY) LOCAL -( -partition p1, partition p2, partition p3, partition p4 -); -- ERROR -DROP TABLE set_tblspc_temp_lineitem1 CASCADE; -DROP TABLE set_tblspc_temp_lineitem2 CASCADE; -DROP TABLE set_tblspc_temp_lineitem3 CASCADE; --- 7. column psort index tablespace -create table test_psort_tblspc -( -id int, -info text -) with(orientation=column) partition by range(id) -( -partition p1 values less than(3000), -partition p2 values less than(6000), -partition p3 values less than(maxvalue) -); -insert into test_psort_tblspc values( 1, 'zhaaaang'), (2,'cahabo'), (3,'wcedi'); -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -vacuum full test_psort_tblspc; -create index idx_test_psort_tblspc on test_psort_tblspc(id,info) local -( -partition p1_idx tablespace hw_cstore_tablespace, -partition p2_idx, -partition p3_idx -); --- check index partition tablespace -WITH - queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), - queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p1_idx' and p.parentid = q.oid ) -SELECT - (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p1_idx' and p.parentid = q.oid ) - = - (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); - -WITH - queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), - queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p2_idx' and p.parentid = q.oid ) -SELECT - (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p2_idx' and p.parentid = q.oid ) - = - (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); - -WITH - queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), - queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p3_idx' and p.parentid = q.oid ) -SELECT - (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p3_idx' and p.parentid = q.oid ) - = - (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); -DROP TABLE test_psort_tblspc CASCADE; -drop tablespace hw_cstore_tablespace; \ No newline at end of file diff --git a/src/test/regress/input/hw_cstore_tablespace_1.source b/src/test/regress/input/hw_cstore_tablespace_1.source new file mode 100644 index 000000000..2d086f4c9 --- /dev/null +++ b/src/test/regress/input/hw_cstore_tablespace_1.source @@ -0,0 +1,48 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_1' +\! mkdir '@testtablespace@/hw_cstore_tablespace_1' + +create tablespace hw_cstore_tablespace_1 location '@testtablespace@/hw_cstore_tablespace_1' MAXSIZE 'UNLIMITEDxxx'; +create tablespace hw_cstore_tablespace_1 location '@testtablespace@/hw_cstore_tablespace_1'; +create table cst1 (a int, b float, c text) with(orientation=column) tablespace hw_cstore_tablespace_1; +drop table cst1; +-- drop tablespace hw_cstore_tablespace_1; + +-- 1. Column Ordinary table + Index table +CREATE TABLE set_tblspc_lineitem_1 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) tablespace hw_cstore_tablespace_1; +COPY set_tblspc_lineitem_1 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +create index idx3_set_tblspc_lineitem_1 on set_tblspc_lineitem_1(L_LINENUMBER, L_SHIPDATE) tablespace hw_cstore_tablespace_1; +-- 1.1 SET TABLESPACE for column table +ALTER TABLE set_tblspc_lineitem_1 SET TABLESPACE pg_default; +-- 1.2 SET TABLESPACE for psort index +ALTER INDEX idx3_set_tblspc_lineitem_1 SET TABLESPACE pg_default; +-- 1.3 tablespace is empty, so drop it for testing +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_1' ); +drop tablespace hw_cstore_tablespace_1; +create tablespace hw_cstore_tablespace_1 location '@testtablespace@/hw_cstore_tablespace_1'; +-- 1.4 Set Tablespace + Add column + Set datatype +ALTER TABLE set_tblspc_lineitem_1 ADD COLUMN c18 int default 100, ALTER COLUMN L_DISCOUNT SET DATA TYPE char(32), SET TABLESPACE hw_cstore_tablespace_1; +drop tablespace hw_cstore_tablespace_1; +ALTER TABLE set_tblspc_lineitem_1 SET TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_1' ); +drop table set_tblspc_lineitem_1 cascade; +drop tablespace hw_cstore_tablespace_1; \ No newline at end of file diff --git a/src/test/regress/input/hw_cstore_tablespace_2.source b/src/test/regress/input/hw_cstore_tablespace_2.source new file mode 100644 index 000000000..ffaef327c --- /dev/null +++ b/src/test/regress/input/hw_cstore_tablespace_2.source @@ -0,0 +1,66 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_2' +\! mkdir '@testtablespace@/hw_cstore_tablespace_2' + +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; + +-- 1. Column Ordinary table + Index table +CREATE TABLE set_tblspc_lineitem_2 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) tablespace hw_cstore_tablespace_2; +COPY set_tblspc_lineitem_2 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +create index idx3_set_tblspc_lineitem_2 on set_tblspc_lineitem_2(L_LINENUMBER, L_SHIPDATE) tablespace pg_default; +-- 1.5 DROP/SET not null +alter table set_tblspc_lineitem_2 alter column L_PARTKEY drop not null; +alter table set_tblspc_lineitem_2 alter column L_PARTKEY set not null; +-- 1.6 whole deleted CU +DELETE FROM set_tblspc_lineitem_2; +ALTER TABLE set_tblspc_lineitem_2 SET TABLESPACE hw_cstore_tablespace_2; +ALTER TABLE set_tblspc_lineitem_2 SET TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); +drop tablespace hw_cstore_tablespace_2; +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; +-- 1.7 rollback +START TRANSACTION; +ALTER TABLE set_tblspc_lineitem_2 SET TABLESPACE hw_cstore_tablespace_2; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); +drop tablespace hw_cstore_tablespace_2; +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; +START TRANSACTION; +ALTER TABLE set_tblspc_lineitem_2 ADD COLUMN c19 int default 1000, SET TABLESPACE hw_cstore_tablespace_2; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); +drop tablespace hw_cstore_tablespace_2; +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; +START TRANSACTION; +ALTER INDEX idx3_set_tblspc_lineitem_2 SET TABLESPACE hw_cstore_tablespace_2; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); +drop tablespace hw_cstore_tablespace_2; +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; +-- 1.8 test drop table +ALTER TABLE idx3_set_tblspc_lineitem_2 SET TABLESPACE hw_cstore_tablespace_2; +drop table set_tblspc_lineitem_2 cascade; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); +drop tablespace hw_cstore_tablespace_2; \ No newline at end of file diff --git a/src/test/regress/input/hw_cstore_tablespace_3.source b/src/test/regress/input/hw_cstore_tablespace_3.source new file mode 100644 index 000000000..935bf6fef --- /dev/null +++ b/src/test/regress/input/hw_cstore_tablespace_3.source @@ -0,0 +1,80 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_3' +\! mkdir '@testtablespace@/hw_cstore_tablespace_3' + +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; + +-- 2. Column Partitioned Table + Index Table +CREATE TABLE set_tblspc_lineitem_3 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) +partition by range(L_ORDERKEY) +( +partition p1 values less than(100000) tablespace hw_cstore_tablespace_3, +partition p2 values less than(200000), +partition p3 values less than(300000), +partition p4 values less than (100000000) +); +COPY set_tblspc_lineitem_3 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +create index idx3_set_tblspc_lineitem_3 on set_tblspc_lineitem_3(L_LINENUMBER) local; +-- 2.1 SET TABLESPACE for partitioned table (heap) +ALTER TABLE set_tblspc_lineitem_3 SET TABLESPACE hw_cstore_tablespace_3; +ALTER TABLE set_tblspc_lineitem_3 ADD COLUMN c18 int default 100, ALTER COLUMN L_DISCOUNT SET DATA TYPE char(32), SET TABLESPACE hw_cstore_tablespace_3; +-- 2.2 SET TABLESPACE for one partition (heap) +ALTER TABLE set_tblspc_lineitem_3 MOVE PARTITION p1 TABLESPACE pg_default, MOVE PARTITION p2 TABLESPACE hw_cstore_tablespace_3; +ALTER TABLE set_tblspc_lineitem_3 MOVE PARTITION p1 TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +drop tablespace hw_cstore_tablespace_3; +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; +-- 2.3 SET TABLESPACE for partitioned table (index) +ALTER INDEX idx3_set_tblspc_lineitem_3 SET TABLESPACE pg_default; +-- 2.4 SET TABLESPACE for one partition (index) +ALTER INDEX idx3_set_tblspc_lineitem_3 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace_3; +drop tablespace hw_cstore_tablespace_3; +ALTER INDEX idx3_set_tblspc_lineitem_3 MOVE PARTITION p1_l_linenumber_idx TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +drop tablespace hw_cstore_tablespace_3; +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; +-- 2.5 rollback +START TRANSACTION; +ALTER TABLE set_tblspc_lineitem_3 MOVE PARTITION p1 TABLESPACE hw_cstore_tablespace_3; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +drop tablespace hw_cstore_tablespace_3; +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; +START TRANSACTION; +ALTER INDEX idx3_set_tblspc_lineitem_3 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace_3; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +drop tablespace hw_cstore_tablespace_3; +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; +-- 2.6 drop table +ALTER TABLE set_tblspc_lineitem_3 MOVE PARTITION p1 TABLESPACE hw_cstore_tablespace_3; +ALTER INDEX idx3_set_tblspc_lineitem_3 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace_3; +drop table set_tblspc_lineitem_3 cascade; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); +drop tablespace hw_cstore_tablespace_3; \ No newline at end of file diff --git a/src/test/regress/input/hw_cstore_tablespace_4.source b/src/test/regress/input/hw_cstore_tablespace_4.source new file mode 100644 index 000000000..6deb3cf62 --- /dev/null +++ b/src/test/regress/input/hw_cstore_tablespace_4.source @@ -0,0 +1,83 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_4' +\! mkdir '@testtablespace@/hw_cstore_tablespace_4' + +create tablespace hw_cstore_tablespace_4 location '@testtablespace@/hw_cstore_tablespace_4'; + +-- 3 test internal mask +create table t_hw_cstore_tablespace_4(c_int int,c_tsvector tsvector,c_tsquery tsquery); +create index idx_1t_hw_cstore_tablespace_4 on t_hw_cstore_tablespace_4 using gist(c_tsvector); +create index idx_2t_hw_cstore_tablespace_4 on t_hw_cstore_tablespace_4 using gin(c_tsvector); +alter index idx_1t_hw_cstore_tablespace_4 reset(fillfactor); +alter index idx_2t_hw_cstore_tablespace_4 set (fastupdate=false); +drop table t_hw_cstore_tablespace_4 cascade; +-- 4. test temp table +CREATE TABLE set_tblspc_lineitem_4 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) tablespace hw_cstore_tablespace_4; +COPY set_tblspc_lineitem_4 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +create index idx3_set_tblspc_lineitem_4 on set_tblspc_lineitem_4(L_LINENUMBER) tablespace hw_cstore_tablespace_4; +ALTER TABLE set_tblspc_lineitem_4 SET TABLESPACE pg_default; +ALTER index idx3_set_tblspc_lineitem_4 SET TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_4' ); +drop tablespace hw_cstore_tablespace_4; +drop table set_tblspc_lineitem_4; +-- 5. test relfilenode.spcNode +-- 5.1 test partitioned table +create tablespace hw_cstore_tablespace_4 location '@testtablespace@/hw_cstore_tablespace_4'; +CREATE TABLE test_cstore_tablespace01(id int, info text) with(orientation=column) +partition by range(id) +( +partition p1 values less than(5) tablespace hw_cstore_tablespace_4, +partition p2 values less than(10) +); +INSERT INTO test_cstore_tablespace01 values(-10), (-9), (-7), (0), (1), (2), (3), (4); +VACUUM FULL test_cstore_tablespace01 partition (p1); +-- rewrite this table and test tablespace oid valid. +ALTER TABLE test_cstore_tablespace01 ADD COLUMN c_char char(5); +SELECT * FROM test_cstore_tablespace01 partition (p1) ORDER BY 1; +DROP TABLE test_cstore_tablespace01; +-- 5.2 test ordinary table +CREATE TABLE test_cstore_tablespace02(id int, info text) with(orientation=column) tablespace hw_cstore_tablespace_4; +INSERT INTO test_cstore_tablespace02 values(-10), (-9), (-7), (0), (1), (2), (3), (4); +VACUUM FULL test_cstore_tablespace02; +-- rewrite this table and test tablespace oid valid. +ALTER TABLE test_cstore_tablespace02 ADD COLUMN c_char char(5), set tablespace pg_default; +SELECT * FROM test_cstore_tablespace02 ORDER BY 1; +DROP TABLE test_cstore_tablespace02; +-- 5.3 test failed Assert() +create table test_cstore_tablespace03( +id int, +info text +) -- row relation +partition by range(id) +( +partition p1 values less than(3000) tablespace pg_default, +partition p2 values less than(6000), +partition p3 values less than(maxvalue) +); +insert into test_cstore_tablespace03 values(generate_series(1,10000),generate_series(1,10000)||'python GaussUpgrade.py -t full-upgrade -l ./new.log'); +-- 5.3.1 Add Column Quickly, so rewrite is false and lock is 8. And Assert() fails. +alter table test_cstore_tablespace03 move partition p1 tablespace hw_cstore_tablespace_4, add column c_char2 char(5); +-- check data right +SELECT COUNT(*) FROM test_cstore_tablespace03; +DROP TABLE test_cstore_tablespace03; + +drop tablespace hw_cstore_tablespace_4; \ No newline at end of file diff --git a/src/test/regress/input/hw_cstore_tablespace_5.source b/src/test/regress/input/hw_cstore_tablespace_5.source new file mode 100644 index 000000000..988bed904 --- /dev/null +++ b/src/test/regress/input/hw_cstore_tablespace_5.source @@ -0,0 +1,204 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_5' +\! mkdir '@testtablespace@/hw_cstore_tablespace_5' + +create tablespace hw_cstore_tablespace_5 location '@testtablespace@/hw_cstore_tablespace_5'; + +-- 6. temp table +-- 6.1 row temp table +CREATE TEMP TABLE set_tblspc_temp_lineitem1 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = row) tablespace hw_cstore_tablespace_5; +COPY set_tblspc_temp_lineitem1 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +ALTER TABLE set_tblspc_temp_lineitem1 SET TABLESPACE pg_default; +SELECT reltablespace FROM pg_class WHERE relname = 'set_tblspc_temp_lineitem1'; -- 0 +-- 6.5 row temp index +CREATE INDEX idx3_set_tblspc_temp_lineitem1 ON set_tblspc_temp_lineitem1(L_LINENUMBER) tablespace hw_cstore_tablespace_5; +ALTER INDEX idx3_set_tblspc_temp_lineitem1 SET TABLESPACE pg_default; +SELECT reltablespace FROM pg_class WHERE relname = 'idx3_set_tblspc_temp_lineitem1'; -- 0 +-- 6.2 column temp table +CREATE TEMP TABLE set_tblspc_temp_lineitem2 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) tablespace hw_cstore_tablespace_5; +INSERT INTO set_tblspc_temp_lineitem2 SELECT * FROM set_tblspc_temp_lineitem1; +ALTER TABLE set_tblspc_temp_lineitem2 SET TABLESPACE pg_default; +SELECT reltablespace FROM pg_class WHERE relname = 'set_tblspc_temp_lineitem2'; -- 0 +-- 6.6 column temp index +CREATE INDEX idx3_set_tblspc_temp_lineitem2 ON set_tblspc_temp_lineitem2(L_LINENUMBER) tablespace hw_cstore_tablespace_5; +ALTER INDEX idx3_set_tblspc_temp_lineitem2 SET TABLESPACE pg_default; +SELECT reltablespace FROM pg_class WHERE relname = 'idx3_set_tblspc_temp_lineitem2'; -- 0 +-- 6.3 row temp partition +CREATE TEMP TABLE set_tblspc_temp_lineitem3 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) with (orientation = row) partition by range(L_PARTKEY) +( +partition p1 values less than(0) , +partition p2 values less than(10) tablespace hw_cstore_tablespace_5, +partition p3 values less than(20), +partition p4 values less than(maxvalue) +); -- ERROR +-- 6.4 column temp partition +CREATE TEMP TABLE set_tblspc_temp_lineitem3 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) with (orientation = column) partition by range(L_PARTKEY) +( +partition p1 values less than(0) , +partition p2 values less than(10) tablespace hw_cstore_tablespace_5, +partition p3 values less than(20), +partition p4 values less than(maxvalue) +); -- ERROR +-- 6.7 row temp index partition +-- 6.8 column temp index partition +CREATE TABLE set_tblspc_temp_lineitem3 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) with (orientation = row) partition by range(L_PARTKEY) +( +partition p1 values less than(0) , +partition p2 values less than(10) tablespace hw_cstore_tablespace_5, +partition p3 values less than(20), +partition p4 values less than(maxvalue) +); +CREATE TEMP INDEX idx_set_tblspc_temp_lineitem3 ON set_tblspc_temp_lineitem3(L_PARTKEY) LOCAL +( +partition p1, partition p2, partition p3, partition p4 +); -- ERROR +DROP TABLE set_tblspc_temp_lineitem1 CASCADE; +DROP TABLE set_tblspc_temp_lineitem2 CASCADE; +DROP TABLE set_tblspc_temp_lineitem3 CASCADE; +-- 7. column psort index tablespace +create table test_psort_tblspc +( +id int, +info text +) with(orientation=column) partition by range(id) +( +partition p1 values less than(3000), +partition p2 values less than(6000), +partition p3 values less than(maxvalue) +); +insert into test_psort_tblspc values( 1, 'zhaaaang'), (2,'cahabo'), (3,'wcedi'); +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +vacuum full test_psort_tblspc; +create index idx_test_psort_tblspc on test_psort_tblspc(id,info) local +( +partition p1_idx tablespace hw_cstore_tablespace_5, +partition p2_idx, +partition p3_idx +); +-- check index partition tablespace +WITH + queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), + queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p1_idx' and p.parentid = q.oid ) +SELECT + (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p1_idx' and p.parentid = q.oid ) + = + (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); + +WITH + queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), + queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p2_idx' and p.parentid = q.oid ) +SELECT + (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p2_idx' and p.parentid = q.oid ) + = + (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); + +WITH + queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), + queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p3_idx' and p.parentid = q.oid ) +SELECT + (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p3_idx' and p.parentid = q.oid ) + = + (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); +DROP TABLE test_psort_tblspc CASCADE; +drop tablespace hw_cstore_tablespace_5; \ No newline at end of file diff --git a/src/test/regress/output/hw_cstore_tablespace.source b/src/test/regress/output/hw_cstore_tablespace.source deleted file mode 100644 index 43be652d4..000000000 --- a/src/test/regress/output/hw_cstore_tablespace.source +++ /dev/null @@ -1,611 +0,0 @@ -\! rm -fr '@testtablespace@/hw_cstore_tablespace' -\! mkdir '@testtablespace@/hw_cstore_tablespace' -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace' MAXSIZE 'UNLIMITEDxxx'; -ERROR: Invalid value for tablespace maxsize: "UNLIMITEDxxx" -HINT: Unknown tablespace size -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -create table cst1 (a int, b float, c text) with(orientation=column) tablespace hw_cstore_tablespace; -drop table cst1; --- drop tablespace hw_cstore_tablespace; --- 1. Column Ordinary table + Index table -CREATE TABLE set_tblspc_lineitem -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = column) tablespace hw_cstore_tablespace; -COPY set_tblspc_lineitem FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; -create index idx3_set_tblspc_lineitem on set_tblspc_lineitem(L_LINENUMBER, L_SHIPDATE) tablespace hw_cstore_tablespace; --- 1.1 SET TABLESPACE for column table -ALTER TABLE set_tblspc_lineitem SET TABLESPACE pg_default; --- 1.2 SET TABLESPACE for psort index -ALTER INDEX idx3_set_tblspc_lineitem SET TABLESPACE pg_default; --- 1.3 tablespace is empty, so drop it for testing -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 1.4 Set Tablespace + Add column + Set datatype -ALTER TABLE set_tblspc_lineitem ADD COLUMN c18 int default 100, ALTER COLUMN L_DISCOUNT SET DATA TYPE char(32), SET TABLESPACE hw_cstore_tablespace; -drop tablespace hw_cstore_tablespace; -ERROR: tablespace "hw_cstore_tablespace" is not empty -ALTER TABLE set_tblspc_lineitem SET TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 1.5 DROP/SET not null -alter table set_tblspc_lineitem alter column L_PARTKEY drop not null; -ERROR: Un-support feature -DETAIL: column-store relation doesn't support this ALTER yet -alter table set_tblspc_lineitem alter column L_PARTKEY set not null; -ERROR: Un-support feature -DETAIL: column-store relation doesn't support this ALTER yet --- 1.6 whole deleted CU -DELETE FROM set_tblspc_lineitem; -ALTER TABLE set_tblspc_lineitem SET TABLESPACE hw_cstore_tablespace; -ALTER TABLE set_tblspc_lineitem SET TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 1.7 rollback -START TRANSACTION; -ALTER TABLE set_tblspc_lineitem SET TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -START TRANSACTION; -ALTER TABLE set_tblspc_lineitem ADD COLUMN c19 int default 1000, SET TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -START TRANSACTION; -ALTER INDEX idx3_set_tblspc_lineitem SET TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 1.8 test drop table -ALTER TABLE idx3_set_tblspc_lineitem SET TABLESPACE hw_cstore_tablespace; -drop table set_tblspc_lineitem; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 2. Column Partitioned Table + Index Table -CREATE TABLE set_tblspc_lineitem2 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = column) -partition by range(L_ORDERKEY) -( -partition p1 values less than(100000) tablespace hw_cstore_tablespace, -partition p2 values less than(200000), -partition p3 values less than(300000), -partition p4 values less than (100000000) -); -COPY set_tblspc_lineitem2 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; -create index idx3_set_tblspc_lineitem2 on set_tblspc_lineitem2(L_LINENUMBER) local; --- 2.1 SET TABLESPACE for partitioned table (heap) -ALTER TABLE set_tblspc_lineitem2 SET TABLESPACE hw_cstore_tablespace; -ERROR: can not set tablespace for partitioned relation -DETAIL: set tablespace for partition instead -ALTER TABLE set_tblspc_lineitem2 ADD COLUMN c18 int default 100, ALTER COLUMN L_DISCOUNT SET DATA TYPE char(32), SET TABLESPACE hw_cstore_tablespace; -ERROR: can not set tablespace for partitioned relation -DETAIL: set tablespace for partition instead --- 2.2 SET TABLESPACE for one partition (heap) -ALTER TABLE set_tblspc_lineitem2 MOVE PARTITION p1 TABLESPACE pg_default, MOVE PARTITION p2 TABLESPACE hw_cstore_tablespace; -ERROR: syntax error at or near "MOVE" -LINE 1: ...ineitem2 MOVE PARTITION p1 TABLESPACE pg_default, MOVE PARTI... - ^ -ALTER TABLE set_tblspc_lineitem2 MOVE PARTITION p1 TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 2.3 SET TABLESPACE for partitioned table (index) -ALTER INDEX idx3_set_tblspc_lineitem2 SET TABLESPACE pg_default; -ERROR: can not set tablespace for partitioned relation -DETAIL: set tablespace for partition instead --- 2.4 SET TABLESPACE for one partition (index) -ALTER INDEX idx3_set_tblspc_lineitem2 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace; -drop tablespace hw_cstore_tablespace; -ERROR: tablespace "hw_cstore_tablespace" is not empty -ALTER INDEX idx3_set_tblspc_lineitem2 MOVE PARTITION p1_l_linenumber_idx TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 2.5 rollback -START TRANSACTION; -ALTER TABLE set_tblspc_lineitem2 MOVE PARTITION p1 TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -START TRANSACTION; -ALTER INDEX idx3_set_tblspc_lineitem2 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace; -CHECKPOINT; -ROLLBACK; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 2.6 drop table -ALTER TABLE set_tblspc_lineitem2 MOVE PARTITION p1 TABLESPACE hw_cstore_tablespace; -ALTER INDEX idx3_set_tblspc_lineitem2 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace; -drop table set_tblspc_lineitem2; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; --- 3 test internal mask -create table t_hw_cstore_tablespace(c_int int,c_tsvector tsvector,c_tsquery tsquery); -create index idx_1t_hw_cstore_tablespace on t_hw_cstore_tablespace using gist(c_tsvector); -create index idx_2t_hw_cstore_tablespace on t_hw_cstore_tablespace using gin(c_tsvector); -alter index idx_1t_hw_cstore_tablespace reset(fillfactor); -alter index idx_2t_hw_cstore_tablespace set (fastupdate=false); --- 4. test temp table -CREATE TABLE set_tblspc_lineitem3 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = column) tablespace hw_cstore_tablespace; -COPY set_tblspc_lineitem3 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; -create index idx3_set_tblspc_lineitem3 on set_tblspc_lineitem3(L_LINENUMBER) tablespace hw_cstore_tablespace; -ALTER TABLE set_tblspc_lineitem3 SET TABLESPACE pg_default; -ALTER index idx3_set_tblspc_lineitem3 SET TABLESPACE pg_default; -SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace' ); - count -------- - 0 -(1 row) - -drop tablespace hw_cstore_tablespace; -drop table set_tblspc_lineitem3; --- 5. test relfilenode.spcNode --- 5.1 test partitioned table -create tablespace hw_cstore_tablespace location '@testtablespace@/hw_cstore_tablespace'; -CREATE TABLE test_cstore_tablespace01(id int, info text) with(orientation=column) -partition by range(id) -( -partition p1 values less than(5) tablespace hw_cstore_tablespace, -partition p2 values less than(10) -); -INSERT INTO test_cstore_tablespace01 values(-10), (-9), (-7), (0), (1), (2), (3), (4); -VACUUM FULL test_cstore_tablespace01 partition (p1); --- rewrite this table and test tablespace oid valid. -ALTER TABLE test_cstore_tablespace01 ADD COLUMN c_char char(5); -SELECT * FROM test_cstore_tablespace01 partition (p1) ORDER BY 1; - id | info | c_char ------+------+-------- - -10 | | - -9 | | - -7 | | - 0 | | - 1 | | - 2 | | - 3 | | - 4 | | -(8 rows) - -DROP TABLE test_cstore_tablespace01; --- 5.2 test ordinary table -CREATE TABLE test_cstore_tablespace02(id int, info text) with(orientation=column) tablespace hw_cstore_tablespace; -INSERT INTO test_cstore_tablespace02 values(-10), (-9), (-7), (0), (1), (2), (3), (4); -VACUUM FULL test_cstore_tablespace02; --- rewrite this table and test tablespace oid valid. -ALTER TABLE test_cstore_tablespace02 ADD COLUMN c_char char(5), set tablespace pg_default; -SELECT * FROM test_cstore_tablespace02 ORDER BY 1; - id | info | c_char ------+------+-------- - -10 | | - -9 | | - -7 | | - 0 | | - 1 | | - 2 | | - 3 | | - 4 | | -(8 rows) - -DROP TABLE test_cstore_tablespace02; --- 5.3 test failed Assert() -create table test_cstore_tablespace03( -id int, -info text -) -- row relation -partition by range(id) -( -partition p1 values less than(3000) tablespace pg_default, -partition p2 values less than(6000), -partition p3 values less than(maxvalue) -); -insert into test_cstore_tablespace03 values(generate_series(1,10000),generate_series(1,10000)||'python GaussUpgrade.py -t full-upgrade -l ./new.log'); --- 5.3.1 Add Column Quickly, so rewrite is false and lock is 8. And Assert() fails. -alter table test_cstore_tablespace03 move partition p1 tablespace hw_cstore_tablespace, add column c_char2 char(5); -ERROR: syntax error at or near "add column" -LINE 1: ...ove partition p1 tablespace hw_cstore_tablespace, add column... - ^ --- check data right -SELECT COUNT(*) FROM test_cstore_tablespace03; - count -------- - 10000 -(1 row) - -DROP TABLE test_cstore_tablespace03; --- 6. temp table --- 6.1 row temp table -CREATE TEMP TABLE set_tblspc_temp_lineitem1 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = row) tablespace hw_cstore_tablespace; -COPY set_tblspc_temp_lineitem1 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; -ALTER TABLE set_tblspc_temp_lineitem1 SET TABLESPACE pg_default; -SELECT reltablespace FROM pg_class WHERE relname = 'set_tblspc_temp_lineitem1'; -- 0 - reltablespace ---------------- - 0 -(1 row) - --- 6.5 row temp index -CREATE INDEX idx3_set_tblspc_temp_lineitem1 ON set_tblspc_temp_lineitem1(L_LINENUMBER) tablespace hw_cstore_tablespace; -ALTER INDEX idx3_set_tblspc_temp_lineitem1 SET TABLESPACE pg_default; -SELECT reltablespace FROM pg_class WHERE relname = 'idx3_set_tblspc_temp_lineitem1'; -- 0 - reltablespace ---------------- - 0 -(1 row) - --- 6.2 column temp table -CREATE TEMP TABLE set_tblspc_temp_lineitem2 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) -with (orientation = column) tablespace hw_cstore_tablespace; -INSERT INTO set_tblspc_temp_lineitem2 SELECT * FROM set_tblspc_temp_lineitem1; -ALTER TABLE set_tblspc_temp_lineitem2 SET TABLESPACE pg_default; -SELECT reltablespace FROM pg_class WHERE relname = 'set_tblspc_temp_lineitem2'; -- 0 - reltablespace ---------------- - 0 -(1 row) - --- 6.6 column temp index -CREATE INDEX idx3_set_tblspc_temp_lineitem2 ON set_tblspc_temp_lineitem2(L_LINENUMBER) tablespace hw_cstore_tablespace; -ALTER INDEX idx3_set_tblspc_temp_lineitem2 SET TABLESPACE pg_default; -SELECT reltablespace FROM pg_class WHERE relname = 'idx3_set_tblspc_temp_lineitem2'; -- 0 - reltablespace ---------------- - 0 -(1 row) - --- 6.3 row temp partition -CREATE TEMP TABLE set_tblspc_temp_lineitem3 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) with (orientation = row) partition by range(L_PARTKEY) -( -partition p1 values less than(0) , -partition p2 values less than(10) tablespace hw_cstore_tablespace, -partition p3 values less than(20), -partition p4 values less than(maxvalue) -); -- ERROR -ERROR: unsupported feature with temporary/unlogged table for partitioned table --- 6.4 column temp partition -CREATE TEMP TABLE set_tblspc_temp_lineitem3 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) with (orientation = column) partition by range(L_PARTKEY) -( -partition p1 values less than(0) , -partition p2 values less than(10) tablespace hw_cstore_tablespace, -partition p3 values less than(20), -partition p4 values less than(maxvalue) -); -- ERROR -ERROR: unsupported feature with temporary/unlogged table for partitioned table --- 6.7 row temp index partition --- 6.8 column temp index partition -CREATE TABLE set_tblspc_temp_lineitem3 -( - L_ORDERKEY BIGINT NOT NULL - , L_PARTKEY BIGINT NOT NULL - , L_SUPPKEY BIGINT NOT NULL - , L_LINENUMBER BIGINT NOT NULL - , L_QUANTITY DECIMAL(15,2) NOT NULL - , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL - , L_DISCOUNT DECIMAL(15,2) NOT NULL - , L_TAX DECIMAL(15,2) NOT NULL - , L_RETURNFLAG CHAR(1) NOT NULL - , L_LINESTATUS CHAR(1) NOT NULL - , L_SHIPDATE DATE NOT NULL - , L_COMMITDATE DATE NOT NULL - , L_RECEIPTDATE DATE NOT NULL - , L_SHIPINSTRUCT CHAR(25) NOT NULL - , L_SHIPMODE CHAR(10) NOT NULL - , L_COMMENT VARCHAR(44) NOT NULL - --, primary key (L_ORDERKEY, L_LINENUMBER) -) with (orientation = row) partition by range(L_PARTKEY) -( -partition p1 values less than(0) , -partition p2 values less than(10) tablespace hw_cstore_tablespace, -partition p3 values less than(20), -partition p4 values less than(maxvalue) -); -CREATE TEMP INDEX idx_set_tblspc_temp_lineitem3 ON set_tblspc_temp_lineitem3(L_PARTKEY) LOCAL -( -partition p1, partition p2, partition p3, partition p4 -); -- ERROR -ERROR: syntax error at or near "INDEX" -LINE 1: CREATE TEMP INDEX idx_set_tblspc_temp_lineitem3 ON set_tblsp... - ^ -DROP TABLE set_tblspc_temp_lineitem1 CASCADE; -DROP TABLE set_tblspc_temp_lineitem2 CASCADE; -DROP TABLE set_tblspc_temp_lineitem3 CASCADE; --- 7. column psort index tablespace -create table test_psort_tblspc -( -id int, -info text -) with(orientation=column) partition by range(id) -( -partition p1 values less than(3000), -partition p2 values less than(6000), -partition p3 values less than(maxvalue) -); -insert into test_psort_tblspc values( 1, 'zhaaaang'), (2,'cahabo'), (3,'wcedi'); -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -insert into test_psort_tblspc select * from test_psort_tblspc ; -vacuum full test_psort_tblspc; -create index idx_test_psort_tblspc on test_psort_tblspc(id,info) local -( -partition p1_idx tablespace hw_cstore_tablespace, -partition p2_idx, -partition p3_idx -); --- check index partition tablespace -WITH - queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), - queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p1_idx' and p.parentid = q.oid ) -SELECT - (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p1_idx' and p.parentid = q.oid ) - = - (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); - ?column? ----------- - t -(1 row) - -WITH - queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), - queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p2_idx' and p.parentid = q.oid ) -SELECT - (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p2_idx' and p.parentid = q.oid ) - = - (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); - ?column? ----------- - t -(1 row) - -WITH - queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), - queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p3_idx' and p.parentid = q.oid ) -SELECT - (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p3_idx' and p.parentid = q.oid ) - = - (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); - ?column? ----------- - t -(1 row) - -DROP TABLE test_psort_tblspc CASCADE; -drop tablespace hw_cstore_tablespace; diff --git a/src/test/regress/output/hw_cstore_tablespace_1.source b/src/test/regress/output/hw_cstore_tablespace_1.source new file mode 100644 index 000000000..19a336d91 --- /dev/null +++ b/src/test/regress/output/hw_cstore_tablespace_1.source @@ -0,0 +1,59 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_1' +\! mkdir '@testtablespace@/hw_cstore_tablespace_1' +create tablespace hw_cstore_tablespace_1 location '@testtablespace@/hw_cstore_tablespace_1' MAXSIZE 'UNLIMITEDxxx'; +ERROR: Invalid value for tablespace maxsize: "UNLIMITEDxxx" +HINT: Unknown tablespace size +create tablespace hw_cstore_tablespace_1 location '@testtablespace@/hw_cstore_tablespace_1'; +create table cst1 (a int, b float, c text) with(orientation=column) tablespace hw_cstore_tablespace_1; +drop table cst1; +-- drop tablespace hw_cstore_tablespace_1; +-- 1. Column Ordinary table + Index table +CREATE TABLE set_tblspc_lineitem_1 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) tablespace hw_cstore_tablespace_1; +COPY set_tblspc_lineitem_1 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +create index idx3_set_tblspc_lineitem_1 on set_tblspc_lineitem_1(L_LINENUMBER, L_SHIPDATE) tablespace hw_cstore_tablespace_1; +-- 1.1 SET TABLESPACE for column table +ALTER TABLE set_tblspc_lineitem_1 SET TABLESPACE pg_default; +-- 1.2 SET TABLESPACE for psort index +ALTER INDEX idx3_set_tblspc_lineitem_1 SET TABLESPACE pg_default; +-- 1.3 tablespace is empty, so drop it for testing +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_1' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_1; +create tablespace hw_cstore_tablespace_1 location '@testtablespace@/hw_cstore_tablespace_1'; +-- 1.4 Set Tablespace + Add column + Set datatype +ALTER TABLE set_tblspc_lineitem_1 ADD COLUMN c18 int default 100, ALTER COLUMN L_DISCOUNT SET DATA TYPE char(32), SET TABLESPACE hw_cstore_tablespace_1; +drop tablespace hw_cstore_tablespace_1; +ERROR: tablespace "hw_cstore_tablespace_1" is not empty +ALTER TABLE set_tblspc_lineitem_1 SET TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_1' ); + count +------- + 0 +(1 row) + +drop table set_tblspc_lineitem_1 cascade; +drop tablespace hw_cstore_tablespace_1; diff --git a/src/test/regress/output/hw_cstore_tablespace_2.source b/src/test/regress/output/hw_cstore_tablespace_2.source new file mode 100644 index 000000000..5c54c4f5d --- /dev/null +++ b/src/test/regress/output/hw_cstore_tablespace_2.source @@ -0,0 +1,93 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_2' +\! mkdir '@testtablespace@/hw_cstore_tablespace_2' +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; +-- 1. Column Ordinary table + Index table +CREATE TABLE set_tblspc_lineitem_2 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) tablespace hw_cstore_tablespace_2; +COPY set_tblspc_lineitem_2 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +create index idx3_set_tblspc_lineitem_2 on set_tblspc_lineitem_2(L_LINENUMBER, L_SHIPDATE) tablespace pg_default; +-- 1.5 DROP/SET not null +alter table set_tblspc_lineitem_2 alter column L_PARTKEY drop not null; +ERROR: Un-support feature +DETAIL: column-store relation doesn't support this ALTER yet +alter table set_tblspc_lineitem_2 alter column L_PARTKEY set not null; +ERROR: Un-support feature +DETAIL: column-store relation doesn't support this ALTER yet +-- 1.6 whole deleted CU +DELETE FROM set_tblspc_lineitem_2; +ALTER TABLE set_tblspc_lineitem_2 SET TABLESPACE hw_cstore_tablespace_2; +ALTER TABLE set_tblspc_lineitem_2 SET TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_2; +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; +-- 1.7 rollback +START TRANSACTION; +ALTER TABLE set_tblspc_lineitem_2 SET TABLESPACE hw_cstore_tablespace_2; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_2; +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; +START TRANSACTION; +ALTER TABLE set_tblspc_lineitem_2 ADD COLUMN c19 int default 1000, SET TABLESPACE hw_cstore_tablespace_2; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_2; +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; +START TRANSACTION; +ALTER INDEX idx3_set_tblspc_lineitem_2 SET TABLESPACE hw_cstore_tablespace_2; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_2; +create tablespace hw_cstore_tablespace_2 location '@testtablespace@/hw_cstore_tablespace_2'; +-- 1.8 test drop table +ALTER TABLE idx3_set_tblspc_lineitem_2 SET TABLESPACE hw_cstore_tablespace_2; +drop table set_tblspc_lineitem_2 cascade; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_2' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_2; diff --git a/src/test/regress/output/hw_cstore_tablespace_3.source b/src/test/regress/output/hw_cstore_tablespace_3.source new file mode 100644 index 000000000..f54ce84c8 --- /dev/null +++ b/src/test/regress/output/hw_cstore_tablespace_3.source @@ -0,0 +1,138 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_3' +\! mkdir '@testtablespace@/hw_cstore_tablespace_3' +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; +-- 2. Column Partitioned Table + Index Table +CREATE TABLE set_tblspc_lineitem_3 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) +partition by range(L_ORDERKEY) +( +partition p1 values less than(100000) tablespace hw_cstore_tablespace_3, +partition p2 values less than(200000), +partition p3 values less than(300000), +partition p4 values less than (100000000) +); +COPY set_tblspc_lineitem_3 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +create index idx3_set_tblspc_lineitem_3 on set_tblspc_lineitem_3(L_LINENUMBER) local; +-- 2.1 SET TABLESPACE for partitioned table (heap) +ALTER TABLE set_tblspc_lineitem_3 SET TABLESPACE hw_cstore_tablespace_3; +ERROR: can not set tablespace for partitioned relation +DETAIL: set tablespace for partition instead +ALTER TABLE set_tblspc_lineitem_3 ADD COLUMN c18 int default 100, ALTER COLUMN L_DISCOUNT SET DATA TYPE char(32), SET TABLESPACE hw_cstore_tablespace_3; +ERROR: can not set tablespace for partitioned relation +DETAIL: set tablespace for partition instead +-- 2.2 SET TABLESPACE for one partition (heap) +ALTER TABLE set_tblspc_lineitem_3 MOVE PARTITION p1 TABLESPACE pg_default, MOVE PARTITION p2 TABLESPACE hw_cstore_tablespace_3; +ERROR: syntax error at or near "MOVE" +LINE 1: ...neitem_3 MOVE PARTITION p1 TABLESPACE pg_default, MOVE PARTI... + ^ +ALTER TABLE set_tblspc_lineitem_3 MOVE PARTITION p1 TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_3; +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; +-- 2.3 SET TABLESPACE for partitioned table (index) +ALTER INDEX idx3_set_tblspc_lineitem_3 SET TABLESPACE pg_default; +ERROR: can not set tablespace for partitioned relation +DETAIL: set tablespace for partition instead +-- 2.4 SET TABLESPACE for one partition (index) +ALTER INDEX idx3_set_tblspc_lineitem_3 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace_3; +drop tablespace hw_cstore_tablespace_3; +ERROR: tablespace "hw_cstore_tablespace_3" is not empty +ALTER INDEX idx3_set_tblspc_lineitem_3 MOVE PARTITION p1_l_linenumber_idx TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_3; +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; +-- 2.5 rollback +START TRANSACTION; +ALTER TABLE set_tblspc_lineitem_3 MOVE PARTITION p1 TABLESPACE hw_cstore_tablespace_3; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_3; +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; +START TRANSACTION; +ALTER INDEX idx3_set_tblspc_lineitem_3 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace_3; +CHECKPOINT; +ROLLBACK; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_3; +create tablespace hw_cstore_tablespace_3 location '@testtablespace@/hw_cstore_tablespace_3'; +-- 2.6 drop table +ALTER TABLE set_tblspc_lineitem_3 MOVE PARTITION p1 TABLESPACE hw_cstore_tablespace_3; +ALTER INDEX idx3_set_tblspc_lineitem_3 MOVE PARTITION p1_l_linenumber_idx TABLESPACE hw_cstore_tablespace_3; +drop table set_tblspc_lineitem_3 cascade; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +SELECT COUNT(*) FROM pg_partition WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_3' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_3; diff --git a/src/test/regress/output/hw_cstore_tablespace_4.source b/src/test/regress/output/hw_cstore_tablespace_4.source new file mode 100644 index 000000000..7e2755af9 --- /dev/null +++ b/src/test/regress/output/hw_cstore_tablespace_4.source @@ -0,0 +1,117 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_4' +\! mkdir '@testtablespace@/hw_cstore_tablespace_4' +create tablespace hw_cstore_tablespace_4 location '@testtablespace@/hw_cstore_tablespace_4'; +-- 3 test internal mask +create table t_hw_cstore_tablespace_4(c_int int,c_tsvector tsvector,c_tsquery tsquery); +create index idx_1t_hw_cstore_tablespace_4 on t_hw_cstore_tablespace_4 using gist(c_tsvector); +create index idx_2t_hw_cstore_tablespace_4 on t_hw_cstore_tablespace_4 using gin(c_tsvector); +alter index idx_1t_hw_cstore_tablespace_4 reset(fillfactor); +alter index idx_2t_hw_cstore_tablespace_4 set (fastupdate=false); +drop table t_hw_cstore_tablespace_4 cascade; +-- 4. test temp table +CREATE TABLE set_tblspc_lineitem_4 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) tablespace hw_cstore_tablespace_4; +COPY set_tblspc_lineitem_4 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +create index idx3_set_tblspc_lineitem_4 on set_tblspc_lineitem_4(L_LINENUMBER) tablespace hw_cstore_tablespace_4; +ALTER TABLE set_tblspc_lineitem_4 SET TABLESPACE pg_default; +ALTER index idx3_set_tblspc_lineitem_4 SET TABLESPACE pg_default; +SELECT COUNT(*) FROM pg_class WHERE reltablespace = ( SELECT OID FROM PG_TABLESPACE WHERE SPCNAME = 'hw_cstore_tablespace_4' ); + count +------- + 0 +(1 row) + +drop tablespace hw_cstore_tablespace_4; +drop table set_tblspc_lineitem_4; +-- 5. test relfilenode.spcNode +-- 5.1 test partitioned table +create tablespace hw_cstore_tablespace_4 location '@testtablespace@/hw_cstore_tablespace_4'; +CREATE TABLE test_cstore_tablespace01(id int, info text) with(orientation=column) +partition by range(id) +( +partition p1 values less than(5) tablespace hw_cstore_tablespace_4, +partition p2 values less than(10) +); +INSERT INTO test_cstore_tablespace01 values(-10), (-9), (-7), (0), (1), (2), (3), (4); +VACUUM FULL test_cstore_tablespace01 partition (p1); +-- rewrite this table and test tablespace oid valid. +ALTER TABLE test_cstore_tablespace01 ADD COLUMN c_char char(5); +SELECT * FROM test_cstore_tablespace01 partition (p1) ORDER BY 1; + id | info | c_char +-----+------+-------- + -10 | | + -9 | | + -7 | | + 0 | | + 1 | | + 2 | | + 3 | | + 4 | | +(8 rows) + +DROP TABLE test_cstore_tablespace01; +-- 5.2 test ordinary table +CREATE TABLE test_cstore_tablespace02(id int, info text) with(orientation=column) tablespace hw_cstore_tablespace_4; +INSERT INTO test_cstore_tablespace02 values(-10), (-9), (-7), (0), (1), (2), (3), (4); +VACUUM FULL test_cstore_tablespace02; +-- rewrite this table and test tablespace oid valid. +ALTER TABLE test_cstore_tablespace02 ADD COLUMN c_char char(5), set tablespace pg_default; +SELECT * FROM test_cstore_tablespace02 ORDER BY 1; + id | info | c_char +-----+------+-------- + -10 | | + -9 | | + -7 | | + 0 | | + 1 | | + 2 | | + 3 | | + 4 | | +(8 rows) + +DROP TABLE test_cstore_tablespace02; +-- 5.3 test failed Assert() +create table test_cstore_tablespace03( +id int, +info text +) -- row relation +partition by range(id) +( +partition p1 values less than(3000) tablespace pg_default, +partition p2 values less than(6000), +partition p3 values less than(maxvalue) +); +insert into test_cstore_tablespace03 values(generate_series(1,10000),generate_series(1,10000)||'python GaussUpgrade.py -t full-upgrade -l ./new.log'); +-- 5.3.1 Add Column Quickly, so rewrite is false and lock is 8. And Assert() fails. +alter table test_cstore_tablespace03 move partition p1 tablespace hw_cstore_tablespace_4, add column c_char2 char(5); +ERROR: syntax error at or near "add column" +LINE 1: ...e partition p1 tablespace hw_cstore_tablespace_4, add column... + ^ +-- check data right +SELECT COUNT(*) FROM test_cstore_tablespace03; + count +------- + 10000 +(1 row) + +DROP TABLE test_cstore_tablespace03; +drop tablespace hw_cstore_tablespace_4; diff --git a/src/test/regress/output/hw_cstore_tablespace_5.source b/src/test/regress/output/hw_cstore_tablespace_5.source new file mode 100644 index 000000000..e3f1ed8f3 --- /dev/null +++ b/src/test/regress/output/hw_cstore_tablespace_5.source @@ -0,0 +1,240 @@ +\! rm -fr '@testtablespace@/hw_cstore_tablespace_5' +\! mkdir '@testtablespace@/hw_cstore_tablespace_5' +create tablespace hw_cstore_tablespace_5 location '@testtablespace@/hw_cstore_tablespace_5'; +-- 6. temp table +-- 6.1 row temp table +CREATE TEMP TABLE set_tblspc_temp_lineitem1 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = row) tablespace hw_cstore_tablespace_5; +COPY set_tblspc_temp_lineitem1 FROM '@abs_srcdir@/data/lineitem_index.data' DELIMITER '|'; +ALTER TABLE set_tblspc_temp_lineitem1 SET TABLESPACE pg_default; +SELECT reltablespace FROM pg_class WHERE relname = 'set_tblspc_temp_lineitem1'; -- 0 + reltablespace +--------------- + 0 +(1 row) + +-- 6.5 row temp index +CREATE INDEX idx3_set_tblspc_temp_lineitem1 ON set_tblspc_temp_lineitem1(L_LINENUMBER) tablespace hw_cstore_tablespace_5; +ALTER INDEX idx3_set_tblspc_temp_lineitem1 SET TABLESPACE pg_default; +SELECT reltablespace FROM pg_class WHERE relname = 'idx3_set_tblspc_temp_lineitem1'; -- 0 + reltablespace +--------------- + 0 +(1 row) + +-- 6.2 column temp table +CREATE TEMP TABLE set_tblspc_temp_lineitem2 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) +with (orientation = column) tablespace hw_cstore_tablespace_5; +INSERT INTO set_tblspc_temp_lineitem2 SELECT * FROM set_tblspc_temp_lineitem1; +ALTER TABLE set_tblspc_temp_lineitem2 SET TABLESPACE pg_default; +SELECT reltablespace FROM pg_class WHERE relname = 'set_tblspc_temp_lineitem2'; -- 0 + reltablespace +--------------- + 0 +(1 row) + +-- 6.6 column temp index +CREATE INDEX idx3_set_tblspc_temp_lineitem2 ON set_tblspc_temp_lineitem2(L_LINENUMBER) tablespace hw_cstore_tablespace_5; +ALTER INDEX idx3_set_tblspc_temp_lineitem2 SET TABLESPACE pg_default; +SELECT reltablespace FROM pg_class WHERE relname = 'idx3_set_tblspc_temp_lineitem2'; -- 0 + reltablespace +--------------- + 0 +(1 row) + +-- 6.3 row temp partition +CREATE TEMP TABLE set_tblspc_temp_lineitem3 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) with (orientation = row) partition by range(L_PARTKEY) +( +partition p1 values less than(0) , +partition p2 values less than(10) tablespace hw_cstore_tablespace_5, +partition p3 values less than(20), +partition p4 values less than(maxvalue) +); -- ERROR +ERROR: unsupported feature with temporary/unlogged table for partitioned table +-- 6.4 column temp partition +CREATE TEMP TABLE set_tblspc_temp_lineitem3 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) with (orientation = column) partition by range(L_PARTKEY) +( +partition p1 values less than(0) , +partition p2 values less than(10) tablespace hw_cstore_tablespace_5, +partition p3 values less than(20), +partition p4 values less than(maxvalue) +); -- ERROR +ERROR: unsupported feature with temporary/unlogged table for partitioned table +-- 6.7 row temp index partition +-- 6.8 column temp index partition +CREATE TABLE set_tblspc_temp_lineitem3 +( + L_ORDERKEY BIGINT NOT NULL + , L_PARTKEY BIGINT NOT NULL + , L_SUPPKEY BIGINT NOT NULL + , L_LINENUMBER BIGINT NOT NULL + , L_QUANTITY DECIMAL(15,2) NOT NULL + , L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL + , L_DISCOUNT DECIMAL(15,2) NOT NULL + , L_TAX DECIMAL(15,2) NOT NULL + , L_RETURNFLAG CHAR(1) NOT NULL + , L_LINESTATUS CHAR(1) NOT NULL + , L_SHIPDATE DATE NOT NULL + , L_COMMITDATE DATE NOT NULL + , L_RECEIPTDATE DATE NOT NULL + , L_SHIPINSTRUCT CHAR(25) NOT NULL + , L_SHIPMODE CHAR(10) NOT NULL + , L_COMMENT VARCHAR(44) NOT NULL + --, primary key (L_ORDERKEY, L_LINENUMBER) +) with (orientation = row) partition by range(L_PARTKEY) +( +partition p1 values less than(0) , +partition p2 values less than(10) tablespace hw_cstore_tablespace_5, +partition p3 values less than(20), +partition p4 values less than(maxvalue) +); +CREATE TEMP INDEX idx_set_tblspc_temp_lineitem3 ON set_tblspc_temp_lineitem3(L_PARTKEY) LOCAL +( +partition p1, partition p2, partition p3, partition p4 +); -- ERROR +ERROR: syntax error at or near "INDEX" +LINE 1: CREATE TEMP INDEX idx_set_tblspc_temp_lineitem3 ON set_tblsp... + ^ +DROP TABLE set_tblspc_temp_lineitem1 CASCADE; +DROP TABLE set_tblspc_temp_lineitem2 CASCADE; +DROP TABLE set_tblspc_temp_lineitem3 CASCADE; +-- 7. column psort index tablespace +create table test_psort_tblspc +( +id int, +info text +) with(orientation=column) partition by range(id) +( +partition p1 values less than(3000), +partition p2 values less than(6000), +partition p3 values less than(maxvalue) +); +insert into test_psort_tblspc values( 1, 'zhaaaang'), (2,'cahabo'), (3,'wcedi'); +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +insert into test_psort_tblspc select * from test_psort_tblspc ; +vacuum full test_psort_tblspc; +create index idx_test_psort_tblspc on test_psort_tblspc(id,info) local +( +partition p1_idx tablespace hw_cstore_tablespace_5, +partition p2_idx, +partition p3_idx +); +-- check index partition tablespace +WITH + queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), + queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p1_idx' and p.parentid = q.oid ) +SELECT + (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p1_idx' and p.parentid = q.oid ) + = + (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); + ?column? +---------- + t +(1 row) + +WITH + queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), + queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p2_idx' and p.parentid = q.oid ) +SELECT + (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p2_idx' and p.parentid = q.oid ) + = + (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); + ?column? +---------- + t +(1 row) + +WITH + queryParent AS (SELECT OID FROM PG_CLASS WHERE relname='idx_test_psort_tblspc'), + queryPsortId AS (SELECT p.relcudescrelid FROM pg_partition p, queryParent q WHERE p.relname = 'p3_idx' and p.parentid = q.oid ) +SELECT + (SELECT p.reltablespace FROM pg_partition p, queryParent q WHERE p.relname = 'p3_idx' and p.parentid = q.oid ) + = + (SELECT c.reltablespace FROM pg_class c, queryPsortId d WHERE c.oid = d.relcudescrelid ); + ?column? +---------- + t +(1 row) + +DROP TABLE test_psort_tblspc CASCADE; +drop tablespace hw_cstore_tablespace_5; diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule index 8f30ed8c1..aa1c69cdd 100644 --- a/src/test/regress/parallel_schedule +++ b/src/test/regress/parallel_schedule @@ -624,7 +624,7 @@ test: hw_cstore_vacuum test: hw_cstore_insert test: hw_cstore_delete test: hw_cstore_unsupport -test: hw_cstore_tablespace +test: hw_cstore_tablespace_1 hw_cstore_tablespace_2 hw_cstore_tablespace_3 hw_cstore_tablespace_4 hw_cstore_tablespace_5 test: hw_cstore_truncate test: hw_cstore_roughcheck test: hw_cstore_update diff --git a/src/test/regress/parallel_schedule.lite b/src/test/regress/parallel_schedule.lite index 98157e8cb..881395c0f 100644 --- a/src/test/regress/parallel_schedule.lite +++ b/src/test/regress/parallel_schedule.lite @@ -451,7 +451,7 @@ test: xc_dml #test: hw_cstore_alter cstore_alter_table2 cstore_alter_table3 cstore_alter_table4 cstore_alter_table5 cstore_alter_table6 cstore_alter_table8 cstore_alter_table9 cstore_alter_table10 hw_cstore_copy hw_alter_table_instant hw_cstore_copy1 #test: cstore_alter_table cstore_alter_table1 cstore_alter_table7 -test: hw_cstore_tablespace hw_cstore_truncate hw_cstore_update +test: hw_cstore_tablespace_1 hw_cstore_tablespace_2 hw_cstore_tablespace_3 hw_cstore_tablespace_4 hw_cstore_tablespace_5 hw_cstore_truncate hw_cstore_update #test: hw_cstore_roughcheck test: hw_cstore_partition_update hw_cstore_partition_update1 hw_cstore_partition_update2 diff --git a/src/test/regress/parallel_schedule.liteB b/src/test/regress/parallel_schedule.liteB index aeb55979d..ce8791b69 100644 --- a/src/test/regress/parallel_schedule.liteB +++ b/src/test/regress/parallel_schedule.liteB @@ -98,7 +98,7 @@ test: gtt_clean #test: hw_cstore_alter cstore_alter_table2 cstore_alter_table3 cstore_alter_table4 cstore_alter_table5 cstore_alter_table6 cstore_alter_table8 cstore_alter_table9 cstore_alter_table10 hw_cstore_copy hw_alter_table_instant hw_cstore_copy1 #test: cstore_alter_table cstore_alter_table1 cstore_alter_table7 -test: hw_cstore_tablespace hw_cstore_truncate hw_cstore_update +test: hw_cstore_tablespace_1 hw_cstore_tablespace_2 hw_cstore_tablespace_3 hw_cstore_tablespace_4 hw_cstore_tablespace_5 hw_cstore_truncate hw_cstore_update #test: hw_cstore_roughcheck test: hw_cstore_partition_update hw_cstore_partition_update1 hw_cstore_partition_update2 diff --git a/src/test/regress/parallel_schedule0 b/src/test/regress/parallel_schedule0 index 4f6a9ebe3..271522065 100644 --- a/src/test/regress/parallel_schedule0 +++ b/src/test/regress/parallel_schedule0 @@ -552,7 +552,7 @@ test: xc_dml #test: hw_cstore_alter cstore_alter_table2 cstore_alter_table3 cstore_alter_table4 cstore_alter_table5 cstore_alter_table6 cstore_alter_table8 cstore_alter_table9 cstore_alter_table10 hw_cstore_copy hw_alter_table_instant hw_cstore_copy1 #test: cstore_alter_table cstore_alter_table1 cstore_alter_table7 -test: hw_cstore_tablespace hw_cstore_truncate hw_cstore_update +test: hw_cstore_tablespace_1 hw_cstore_tablespace_2 hw_cstore_tablespace_3 hw_cstore_tablespace_4 hw_cstore_tablespace_5 hw_cstore_truncate hw_cstore_update #test: hw_cstore_roughcheck test: hw_cstore_partition_update hw_cstore_partition_update1 hw_cstore_partition_update2 hw_cstore_partition diff --git a/src/test/regress/parallel_schedule0B b/src/test/regress/parallel_schedule0B index a68ed6c69..b2f4c045f 100644 --- a/src/test/regress/parallel_schedule0B +++ b/src/test/regress/parallel_schedule0B @@ -98,7 +98,7 @@ test: gtt_clean #test: hw_cstore_alter cstore_alter_table2 cstore_alter_table3 cstore_alter_table4 cstore_alter_table5 cstore_alter_table6 cstore_alter_table8 cstore_alter_table9 cstore_alter_table10 hw_cstore_copy hw_alter_table_instant hw_cstore_copy1 #test: cstore_alter_table cstore_alter_table1 cstore_alter_table7 -test: hw_cstore_tablespace hw_cstore_truncate hw_cstore_update +test: hw_cstore_tablespace_1 hw_cstore_tablespace_2 hw_cstore_tablespace_3 hw_cstore_tablespace_4 hw_cstore_tablespace_5 hw_cstore_truncate hw_cstore_update #test: hw_cstore_roughcheck test: hw_cstore_partition_update hw_cstore_partition_update1 hw_cstore_partition_update2 diff --git a/src/test/regress/parallel_schedule7 b/src/test/regress/parallel_schedule7 index ead834da0..53663d459 100644 --- a/src/test/regress/parallel_schedule7 +++ b/src/test/regress/parallel_schedule7 @@ -14,7 +14,7 @@ test: hw_cstore_alter cstore_alter_table2 cstore_alter_table5 cstore_alter_table #test: hw_cstore_insert #test: hw_cstore_delete #test: hw_cstore_unsupport -test: hw_cstore_tablespace +test: hw_cstore_tablespace_1 hw_cstore_tablespace_2 hw_cstore_tablespace_3 hw_cstore_tablespace_4 hw_cstore_tablespace_5 #test: hw_cstore_truncate #test: hw_cstore_roughcheck #test: hw_cstore_update