optimize the message for create table

This commit is contained in:
wuyuechuan
2022-06-06 10:52:22 +08:00
parent 777523d6ce
commit 11d53786f7
4 changed files with 42 additions and 11 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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
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);