From 777523d6ce0ac9df542618c5043a5b831b808dba Mon Sep 17 00:00:00 2001 From: wuyuechuan Date: Thu, 2 Jun 2022 17:23:33 +0800 Subject: [PATCH 1/2] change log of `alter compresstype\compress_chunk_size` --- .../optimizer/commands/tablecmds.cpp | 8 ++- .../storage/access/common/reloptions.cpp | 2 +- .../row_compression/unsupported_feature.out | 72 ++++++++++--------- .../row_compression/unsupported_feature.sql | 70 +++++++++--------- 4 files changed, 82 insertions(+), 70 deletions(-) diff --git a/src/gausskernel/optimizer/commands/tablecmds.cpp b/src/gausskernel/optimizer/commands/tablecmds.cpp index 6f0791a05..88244786d 100644 --- a/src/gausskernel/optimizer/commands/tablecmds.cpp +++ b/src/gausskernel/optimizer/commands/tablecmds.cpp @@ -14729,9 +14729,13 @@ static void ATExecSetRelOptions(Relation rel, List* defList, AlterTableType oper errmsg("\"%s\" is not a table, view, materialized view, index, or TOAST table", RelationGetRelationName(rel)))); break; } - + + if (rel->rd_options && REL_SUPPORT_COMPRESSED(rel)) { + SetupPageCompressForRelation(&rel->rd_node, &((StdRdOptions *)(rel->rd_options))->compress, + RelationGetRelationName(rel)); + } CheckSupportModifyCompression(rel, relOpt, defList); - + /* * All we need do here is update the pg_class row; the new options will be * propagated into relcaches during post-commit cache inval. diff --git a/src/gausskernel/storage/access/common/reloptions.cpp b/src/gausskernel/storage/access/common/reloptions.cpp index 306c1e6e4..a77abfe15 100644 --- a/src/gausskernel/storage/access/common/reloptions.cpp +++ b/src/gausskernel/storage/access/common/reloptions.cpp @@ -2635,7 +2635,7 @@ void ForbidUserToSetCompressedOptions(List *options) if (FindInvalidOption(options, unSupportOptions, lengthof(unSupportOptions), &firstInvalidOpt)) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - (errmsg("Un-support feature"), errdetail("Option \"%s\" doesn't allow ALTER on uncompressed table", + (errmsg("Un-support feature"), errdetail("Option \"%s\" doesn't allow ALTER", unSupportOptions[firstInvalidOpt])))); } } diff --git a/src/test/regress/expected/row_compression/unsupported_feature.out b/src/test/regress/expected/row_compression/unsupported_feature.out index 14d8d926f..469000151 100644 --- a/src/test/regress/expected/row_compression/unsupported_feature.out +++ b/src/test/regress/expected/row_compression/unsupported_feature.out @@ -1,25 +1,25 @@ -create schema unspported_feature; +create schema unsupported_feature; -- unspport compressType: 3 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=3, compress_chunk_size=1024); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=3, compress_chunk_size=1024); ERROR: value 3 out of bounds for option "compresstype" DETAIL: Valid values are between "0" and "2". -- unspport compress_chunk_size: 2000 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_chunk_size=2000); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_chunk_size=2000); ERROR: invalid compress_chunk_size 2000 , must be one of 512, 1024, 2048 or 4096 for compressed_table_1024 -- unspport compress_prealloc_chunks: -1 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_prealloc_chunks=-1); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_prealloc_chunks=-1); ERROR: value -1 out of bounds for option "compress_prealloc_chunks" DETAIL: Valid values are between "0" and "7". -- unspport compress_prealloc_chunks: 8 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_prealloc_chunks=8); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_prealloc_chunks=8); ERROR: value 8 out of bounds for option "compress_prealloc_chunks" DETAIL: Valid values are between "0" and "7". -- unspport compress_level: 128 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_level=128); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_level=128); ERROR: value 128 out of bounds for option "compress_level" DETAIL: Valid values are between "-31" and "31". -- compresstype cant be used with column table -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(ORIENTATION = 'column', compresstype=2); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(ORIENTATION = 'column', compresstype=2); ERROR: only row orientation table support compresstype. -- compresstype cant be used with temp table CREATE TEMP TABLE compressed_temp_table_1024(id int) WITH(compresstype=2); @@ -28,19 +28,19 @@ ERROR: only row orientation table support compresstype. CREATE unlogged TABLE compressed_unlogged_table_1024(id int) WITH(compresstype=2); ERROR: only row orientation table support compresstype. -- use compress_prealloc_chunks\compress_chunk_size\compress_level without compresstype -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_prealloc_chunks=5); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_prealloc_chunks=5); ERROR: compress_chunk_size/compress_prealloc_chunks/compress_level/compress_byte_convert/compress_diff_convert should be used with compresstype. -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_chunk_size=1024); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_chunk_size=1024); ERROR: compress_chunk_size/compress_prealloc_chunks/compress_level/compress_byte_convert/compress_diff_convert should be used with compresstype. -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_byte_convert=true); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_byte_convert=true); ERROR: compress_chunk_size/compress_prealloc_chunks/compress_level/compress_byte_convert/compress_diff_convert should be used with compresstype. -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_diff_convert=true); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_diff_convert=true); ERROR: compress_chunk_size/compress_prealloc_chunks/compress_level/compress_byte_convert/compress_diff_convert should be used with compresstype. -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_level=5); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_level=5); ERROR: compress_chunk_size/compress_prealloc_chunks/compress_level/compress_byte_convert/compress_diff_convert should be used with compresstype. -- unspport exchange -CREATE TABLE unspported_feature.exchange_table(id int) WITH(compresstype=2); -CREATE TABLE unspported_feature.alter_table(id int) partition by range(id) +CREATE TABLE unsupported_feature.exchange_table(id int) WITH(compresstype=2); +CREATE TABLE unsupported_feature.alter_table(id int) partition by range(id) ( partition p0 values less than(5000), partition p1 values less than(10000), @@ -51,46 +51,50 @@ CREATE TABLE unspported_feature.alter_table(id int) partition by range(id) partition p6 values less than(60000), partition p7 values less than(70000) ); -ALTER TABLE unspported_feature.alter_table EXCHANGE PARTITION FOR(2500) WITH TABLE unspported_feature.exchange_table; +ALTER TABLE unsupported_feature.alter_table EXCHANGE PARTITION FOR(2500) WITH TABLE unsupported_feature.exchange_table; ERROR: tables in ALTER TABLE EXCHANGE PARTITION must have the same type of compress -- unspport alter compress_chunk_size -create TABLE unspported_feature.alter_table_option(id int) WITH(compresstype=2); -\d+ unspported_feature.alter_table_option - Table "unspported_feature.alter_table_option" +create TABLE unsupported_feature.alter_table_option(id int) WITH(compresstype=2); +\d+ unsupported_feature.alter_table_option + Table "unsupported_feature.alter_table_option" Column | Type | Modifiers | Storage | Stats target | Description --------+---------+-----------+---------+--------------+------------- id | integer | | plain | | Has OIDs: no Options: orientation=row, compresstype=2 -ALTER TABLE unspported_feature.alter_table_option SET(compresstype=0); -- fail +ALTER TABLE unsupported_feature.alter_table_option SET(compresstype=0); -- fail ERROR: change compresstype OPTION is not supported -ALTER TABLE unspported_feature.alter_table_option SET(compress_chunk_size=2048); -- fail +ALTER TABLE unsupported_feature.alter_table_option SET(compress_chunk_size=2048); -- fail ERROR: change compress_chunk_size OPTION is not supported -ALTER TABLE unspported_feature.alter_table_option SET(compress_level=2, compress_prealloc_chunks=0); +ALTER TABLE unsupported_feature.alter_table_option SET(compress_level=2, compress_prealloc_chunks=0); -- alter compress_byte_convert\compress_diff_convert -create table unspported_feature.rolcompress_table_001(a int) with (compresstype=2, compress_diff_convert=true); -- fail +create table unsupported_feature.rolcompress_table_001(a int) with (compresstype=2, compress_diff_convert=true); -- fail ERROR: compress_diff_convert should be used with compress_byte_convert. -create table unspported_feature.t_rowcompress_0007(cid int, name varchar2) with (compresstype=1); -alter table unspported_feature.t_rowcompress_0007 set (compress_diff_convert=true); --fail +create table unsupported_feature.t_rowcompress_0007(cid int, name varchar2) with (compresstype=1); +alter table unsupported_feature.t_rowcompress_0007 set (compress_diff_convert=true); --fail ERROR: compress_diff_convert should be used with compress_byte_convert. -alter table unspported_feature.t_rowcompress_0007 set (compress_byte_convert=true, compress_diff_convert=true); --success -alter table unspported_feature.t_rowcompress_0007 set (compress_level=31); --failed +alter table unsupported_feature.t_rowcompress_0007 set (compress_byte_convert=true, compress_diff_convert=true); --success +alter table unsupported_feature.t_rowcompress_0007 set (compress_level=31); --failed ERROR: compress_level should be used with ZSTD algorithm. -create table unspported_feature.t_rowcompress_pglz_compresslevel(id int) with (compresstype=1,compress_level=2); -- failed +create table unsupported_feature.t_rowcompress_pglz_compresslevel(id int) with (compresstype=1,compress_level=2); -- failed ERROR: compress_level should be used with ZSTD algorithm. -create table unspported_feature.t_rowcompress_pglz_compresslevel(id int) with (compresstype=2,compress_level=2); -- success -CREATE TABLE unspported_feature.index_test(id int, c1 text); +create table unsupported_feature.t_rowcompress_pglz_compresslevel(id int) with (compresstype=2,compress_level=2); -- success +CREATE TABLE unsupported_feature.index_test(id int, c1 text); -- ustore -CREATE TABLE unspported_feature.ustore_table(id int, c1 text) WITH(compresstype=2, storage_type=ustore); --failed +CREATE TABLE unsupported_feature.ustore_table(id int, c1 text) WITH(compresstype=2, storage_type=ustore); --failed ERROR: only row orientation table support compresstype. -CREATE INDEX tbl_pc_idx1 on unspported_feature.index_test(c1) WITH(compresstype=2, storage_type=ustore); --failed +CREATE INDEX tbl_pc_idx1 on unsupported_feature.index_test(c1) WITH(compresstype=2, storage_type=ustore); --failed ERROR: Can not use compress option in ustore index. -- segment -CREATE TABLE unspported_feature.segment_table(id int, c1 text) WITH(compresstype=2, segment=on); --failed +CREATE TABLE unsupported_feature.segment_table(id int, c1 text) WITH(compresstype=2, segment=on); --failed ERROR: only row orientation table support compresstype. -CREATE INDEX on unspported_feature.index_test(c1) WITH(compresstype=2, segment=on); --failed +CREATE INDEX on unsupported_feature.index_test(c1) WITH(compresstype=2, segment=on); --failed ERROR: Can not use compress option in segment storage. -- set compress_diff_convert -create table unspported_feature.compress_byte_test(id int) with (compresstype=2, compress_byte_convert=false, compress_diff_convert = true); -- failed +create table unsupported_feature.compress_byte_test(id int) with (compresstype=2, compress_byte_convert=false, compress_diff_convert = true); -- failed ERROR: compress_diff_convert should be used with compress_byte_convert. +create table unsupported_feature.test(id int) with (compresstype=2); -- success +alter table unsupported_feature.test set(Compresstype=1); -- failed +ERROR: change compresstype OPTION is not supported +alter table unsupported_feature.test set(Compress_level=3); -- success diff --git a/src/test/regress/sql/row_compression/unsupported_feature.sql b/src/test/regress/sql/row_compression/unsupported_feature.sql index 8ee08b70c..3fa3aec46 100644 --- a/src/test/regress/sql/row_compression/unsupported_feature.sql +++ b/src/test/regress/sql/row_compression/unsupported_feature.sql @@ -1,29 +1,29 @@ -create schema unspported_feature; +create schema unsupported_feature; -- unspport compressType: 3 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=3, compress_chunk_size=1024); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=3, compress_chunk_size=1024); -- unspport compress_chunk_size: 2000 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_chunk_size=2000); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_chunk_size=2000); -- unspport compress_prealloc_chunks: -1 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_prealloc_chunks=-1); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_prealloc_chunks=-1); -- unspport compress_prealloc_chunks: 8 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_prealloc_chunks=8); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_prealloc_chunks=8); -- unspport compress_level: 128 -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_level=128); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compresstype=2, compress_level=128); -- compresstype cant be used with column table -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(ORIENTATION = 'column', compresstype=2); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(ORIENTATION = 'column', compresstype=2); -- compresstype cant be used with temp table CREATE TEMP TABLE compressed_temp_table_1024(id int) WITH(compresstype=2); -- compresstype cant be used with unlogged table CREATE unlogged TABLE compressed_unlogged_table_1024(id int) WITH(compresstype=2); -- use compress_prealloc_chunks\compress_chunk_size\compress_level without compresstype -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_prealloc_chunks=5); -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_chunk_size=1024); -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_byte_convert=true); -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_diff_convert=true); -CREATE TABLE unspported_feature.compressed_table_1024(id int) WITH(compress_level=5); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_prealloc_chunks=5); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_chunk_size=1024); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_byte_convert=true); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_diff_convert=true); +CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_level=5); -- unspport exchange -CREATE TABLE unspported_feature.exchange_table(id int) WITH(compresstype=2); -CREATE TABLE unspported_feature.alter_table(id int) partition by range(id) +CREATE TABLE unsupported_feature.exchange_table(id int) WITH(compresstype=2); +CREATE TABLE unsupported_feature.alter_table(id int) partition by range(id) ( partition p0 values less than(5000), partition p1 values less than(10000), @@ -34,29 +34,33 @@ CREATE TABLE unspported_feature.alter_table(id int) partition by range(id) partition p6 values less than(60000), partition p7 values less than(70000) ); -ALTER TABLE unspported_feature.alter_table EXCHANGE PARTITION FOR(2500) WITH TABLE unspported_feature.exchange_table; +ALTER TABLE unsupported_feature.alter_table EXCHANGE PARTITION FOR(2500) WITH TABLE unsupported_feature.exchange_table; -- unspport alter compress_chunk_size -create TABLE unspported_feature.alter_table_option(id int) WITH(compresstype=2); -\d+ unspported_feature.alter_table_option -ALTER TABLE unspported_feature.alter_table_option SET(compresstype=0); -- fail -ALTER TABLE unspported_feature.alter_table_option SET(compress_chunk_size=2048); -- fail -ALTER TABLE unspported_feature.alter_table_option SET(compress_level=2, compress_prealloc_chunks=0); +create TABLE unsupported_feature.alter_table_option(id int) WITH(compresstype=2); +\d+ unsupported_feature.alter_table_option +ALTER TABLE unsupported_feature.alter_table_option SET(compresstype=0); -- fail +ALTER TABLE unsupported_feature.alter_table_option SET(compress_chunk_size=2048); -- fail +ALTER TABLE unsupported_feature.alter_table_option SET(compress_level=2, compress_prealloc_chunks=0); -- alter compress_byte_convert\compress_diff_convert -create table unspported_feature.rolcompress_table_001(a int) with (compresstype=2, compress_diff_convert=true); -- fail +create table unsupported_feature.rolcompress_table_001(a int) with (compresstype=2, compress_diff_convert=true); -- fail -create table unspported_feature.t_rowcompress_0007(cid int, name varchar2) with (compresstype=1); -alter table unspported_feature.t_rowcompress_0007 set (compress_diff_convert=true); --fail -alter table unspported_feature.t_rowcompress_0007 set (compress_byte_convert=true, compress_diff_convert=true); --success -alter table unspported_feature.t_rowcompress_0007 set (compress_level=31); --failed -create table unspported_feature.t_rowcompress_pglz_compresslevel(id int) with (compresstype=1,compress_level=2); -- failed -create table unspported_feature.t_rowcompress_pglz_compresslevel(id int) with (compresstype=2,compress_level=2); -- success +create table unsupported_feature.t_rowcompress_0007(cid int, name varchar2) with (compresstype=1); +alter table unsupported_feature.t_rowcompress_0007 set (compress_diff_convert=true); --fail +alter table unsupported_feature.t_rowcompress_0007 set (compress_byte_convert=true, compress_diff_convert=true); --success +alter table unsupported_feature.t_rowcompress_0007 set (compress_level=31); --failed +create table unsupported_feature.t_rowcompress_pglz_compresslevel(id int) with (compresstype=1,compress_level=2); -- failed +create table unsupported_feature.t_rowcompress_pglz_compresslevel(id int) with (compresstype=2,compress_level=2); -- success -CREATE TABLE unspported_feature.index_test(id int, c1 text); +CREATE TABLE unsupported_feature.index_test(id int, c1 text); -- ustore -CREATE TABLE unspported_feature.ustore_table(id int, c1 text) WITH(compresstype=2, storage_type=ustore); --failed -CREATE INDEX tbl_pc_idx1 on unspported_feature.index_test(c1) WITH(compresstype=2, storage_type=ustore); --failed +CREATE TABLE unsupported_feature.ustore_table(id int, c1 text) WITH(compresstype=2, storage_type=ustore); --failed +CREATE INDEX tbl_pc_idx1 on unsupported_feature.index_test(c1) WITH(compresstype=2, storage_type=ustore); --failed -- segment -CREATE TABLE unspported_feature.segment_table(id int, c1 text) WITH(compresstype=2, segment=on); --failed -CREATE INDEX on unspported_feature.index_test(c1) WITH(compresstype=2, segment=on); --failed +CREATE TABLE unsupported_feature.segment_table(id int, c1 text) WITH(compresstype=2, segment=on); --failed +CREATE INDEX on unsupported_feature.index_test(c1) WITH(compresstype=2, segment=on); --failed -- set compress_diff_convert -create table unspported_feature.compress_byte_test(id int) with (compresstype=2, compress_byte_convert=false, compress_diff_convert = true); -- failed \ No newline at end of file +create table unsupported_feature.compress_byte_test(id int) with (compresstype=2, compress_byte_convert=false, compress_diff_convert = true); -- failed + +create table unsupported_feature.test(id int) with (compresstype=2); -- success +alter table unsupported_feature.test set(Compresstype=1); -- failed +alter table unsupported_feature.test set(Compress_level=3); -- success \ No newline at end of file From 11d53786f7788f0115b4e404c4069dfa4477217d Mon Sep 17 00:00:00 2001 From: wuyuechuan Date: Mon, 6 Jun 2022 10:52:22 +0800 Subject: [PATCH 2/2] optimize the message for `create table` --- .../optimizer/commands/tablecmds.cpp | 3 ++- src/include/storage/page_compression.h | 8 +++--- .../row_compression/unsupported_feature.out | 25 +++++++++++++++---- .../row_compression/unsupported_feature.sql | 17 ++++++++++++- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/gausskernel/optimizer/commands/tablecmds.cpp b/src/gausskernel/optimizer/commands/tablecmds.cpp index 88244786d..db31fc2d1 100644 --- a/src/gausskernel/optimizer/commands/tablecmds.cpp +++ b/src/gausskernel/optimizer/commands/tablecmds.cpp @@ -1167,7 +1167,8 @@ static List* AddDefaultOptionsIfNeed(List* options, const char relkind, CreateSt stmt->relation->relpersistence == RELPERSISTENCE_TEMP || stmt->relation->relpersistence == RELPERSISTENCE_GLOBAL_TEMP; if (noSupportTable && tableCreateSupport.compressType) { - ereport(ERROR, (errcode(ERRCODE_INVALID_OPTION), errmsg("only row orientation table support compresstype."))); + ereport(ERROR, (errcode(ERRCODE_INVALID_OPTION), errmsg("compresstype can not be used in ustore table, segment table, " + "column table, view, unlogged table or temp table."))); } CheckCompressOption(&tableCreateSupport); diff --git a/src/include/storage/page_compression.h b/src/include/storage/page_compression.h index 0dfafe167..e28b73581 100644 --- a/src/include/storage/page_compression.h +++ b/src/include/storage/page_compression.h @@ -41,10 +41,10 @@ constexpr uint32 COMPRESS_ADDRESS_FLUSH_CHUNKS = 5000; #define SUPPORT_COMPRESSED(relKind, relam) \ - ((relKind) == RELKIND_RELATION || ((relKind) == RELKIND_INDEX && (relam) == BTREE_AM_OID)) -#define REL_SUPPORT_COMPRESSED(relation) \ - (((relation)->rd_rel->relkind) == RELKIND_RELATION || \ - (((relation)->rd_rel->relkind) == RELKIND_INDEX && ((relation)->rd_rel->relam) == BTREE_AM_OID)) + ((relKind) == RELKIND_RELATION || \ + (((relKind) == RELKIND_INDEX || (relKind == RELKIND_GLOBAL_INDEX)) && (relam) == BTREE_AM_OID)) + +#define REL_SUPPORT_COMPRESSED(relation) SUPPORT_COMPRESSED((relation)->rd_rel->relkind, (relation)->rd_rel->relam) typedef uint32 pc_chunk_number_t; const uint32 PAGE_COMPRESSION_VERSION = 92603; diff --git a/src/test/regress/expected/row_compression/unsupported_feature.out b/src/test/regress/expected/row_compression/unsupported_feature.out index 469000151..8d5a0cb2a 100644 --- a/src/test/regress/expected/row_compression/unsupported_feature.out +++ b/src/test/regress/expected/row_compression/unsupported_feature.out @@ -20,13 +20,13 @@ ERROR: value 128 out of bounds for option "compress_level" DETAIL: Valid values are between "-31" and "31". -- compresstype cant be used with column table CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(ORIENTATION = 'column', compresstype=2); -ERROR: only row orientation table support compresstype. +ERROR: compresstype can not be used in ustore table, segment table, column table, view, unlogged table or temp table. -- compresstype cant be used with temp table CREATE TEMP TABLE compressed_temp_table_1024(id int) WITH(compresstype=2); -ERROR: only row orientation table support compresstype. +ERROR: compresstype can not be used in ustore table, segment table, column table, view, unlogged table or temp table. -- compresstype cant be used with unlogged table CREATE unlogged TABLE compressed_unlogged_table_1024(id int) WITH(compresstype=2); -ERROR: only row orientation table support compresstype. +ERROR: compresstype can not be used in ustore table, segment table, column table, view, unlogged table or temp table. -- use compress_prealloc_chunks\compress_chunk_size\compress_level without compresstype CREATE TABLE unsupported_feature.compressed_table_1024(id int) WITH(compress_prealloc_chunks=5); ERROR: compress_chunk_size/compress_prealloc_chunks/compress_level/compress_byte_convert/compress_diff_convert should be used with compresstype. @@ -83,12 +83,12 @@ create table unsupported_feature.t_rowcompress_pglz_compresslevel(id int) with ( CREATE TABLE unsupported_feature.index_test(id int, c1 text); -- ustore CREATE TABLE unsupported_feature.ustore_table(id int, c1 text) WITH(compresstype=2, storage_type=ustore); --failed -ERROR: only row orientation table support compresstype. +ERROR: compresstype can not be used in ustore table, segment table, column table, view, unlogged table or temp table. CREATE INDEX tbl_pc_idx1 on unsupported_feature.index_test(c1) WITH(compresstype=2, storage_type=ustore); --failed ERROR: Can not use compress option in ustore index. -- segment CREATE TABLE unsupported_feature.segment_table(id int, c1 text) WITH(compresstype=2, segment=on); --failed -ERROR: only row orientation table support compresstype. +ERROR: compresstype can not be used in ustore table, segment table, column table, view, unlogged table or temp table. CREATE INDEX on unsupported_feature.index_test(c1) WITH(compresstype=2, segment=on); --failed ERROR: Can not use compress option in segment storage. -- set compress_diff_convert @@ -98,3 +98,18 @@ create table unsupported_feature.test(id int) with (compresstype=2); -- success alter table unsupported_feature.test set(Compresstype=1); -- failed ERROR: change compresstype OPTION is not supported alter table unsupported_feature.test set(Compress_level=3); -- success +create table lm_rcp_4 (c1 int,c2 varchar2,c3 number,c4 money,c5 CHAR(20),c6 CLOB,c7 blob,c8 DATE,c9 BOOLEAN,c10 TIMESTAMP,c11 point,columns12 cidr) with(Compresstype=2,Compress_chunk_size=512) + partition by list(c1) subpartition by range(c3)( + partition ts1 values(1,2,3,4,5)(subpartition ts11 values less than(500),subpartition ts12 values less than(5000),subpartition ts13 values less than(MAXVALUE)), + partition ts2 values(6,7,8,9,10), + partition ts3 values(11,12,13,14,15)(subpartition ts31 values less than(5000),subpartition ts32 values less than(10000),subpartition ts33 values less than(MAXVALUE)), + partition ts4 values(default)); +create unique index indexg_lm_rcp_4 on lm_rcp_4(c1 NULLS first,c2,c3) global +with(FILLFACTOR=80,Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert=1); +--s3. +alter index indexg_lm_rcp_4 rename to indexg_lm_rcp_4_newname; +--s4.修改压缩类型 +alter index indexg_lm_rcp_4_newname set(Compresstype=1); +ERROR: change compresstype OPTION is not supported +--s5.修改Compress_level +alter index indexg_lm_rcp_4_newname set(Compress_level=3); diff --git a/src/test/regress/sql/row_compression/unsupported_feature.sql b/src/test/regress/sql/row_compression/unsupported_feature.sql index 3fa3aec46..81d395c3a 100644 --- a/src/test/regress/sql/row_compression/unsupported_feature.sql +++ b/src/test/regress/sql/row_compression/unsupported_feature.sql @@ -63,4 +63,19 @@ create table unsupported_feature.compress_byte_test(id int) with (compresstype=2 create table unsupported_feature.test(id int) with (compresstype=2); -- success alter table unsupported_feature.test set(Compresstype=1); -- failed -alter table unsupported_feature.test set(Compress_level=3); -- success \ No newline at end of file +alter table unsupported_feature.test set(Compress_level=3); -- success + +create table lm_rcp_4 (c1 int,c2 varchar2,c3 number,c4 money,c5 CHAR(20),c6 CLOB,c7 blob,c8 DATE,c9 BOOLEAN,c10 TIMESTAMP,c11 point,columns12 cidr) with(Compresstype=2,Compress_chunk_size=512) + partition by list(c1) subpartition by range(c3)( + partition ts1 values(1,2,3,4,5)(subpartition ts11 values less than(500),subpartition ts12 values less than(5000),subpartition ts13 values less than(MAXVALUE)), + partition ts2 values(6,7,8,9,10), + partition ts3 values(11,12,13,14,15)(subpartition ts31 values less than(5000),subpartition ts32 values less than(10000),subpartition ts33 values less than(MAXVALUE)), + partition ts4 values(default)); +create unique index indexg_lm_rcp_4 on lm_rcp_4(c1 NULLS first,c2,c3) global +with(FILLFACTOR=80,Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert=1); +--s3. +alter index indexg_lm_rcp_4 rename to indexg_lm_rcp_4_newname; +--s4.修改压缩类型 +alter index indexg_lm_rcp_4_newname set(Compresstype=1); +--s5.修改Compress_level +alter index indexg_lm_rcp_4_newname set(Compress_level=3); \ No newline at end of file