!2219 remove compress option when alter delta table of column table

Merge pull request !2219 from 吴岳川/master
This commit is contained in:
opengauss-bot
2022-09-23 11:08:53 +00:00
committed by Gitee
3 changed files with 28 additions and 4 deletions

View File

@ -9827,6 +9827,8 @@ static void ATExecAddColumn(List** wqueue, AlteredTableInfo* tab, Relation rel,
}
#endif
bool isDelta = RELATION_IS_DELTA(rel);
/* construct new attribute's pg_attribute entry */
attribute.attrelid = myrelid;
(void)namestrcpy(&(attribute.attname), colDef->colname);
@ -9845,14 +9847,18 @@ static void ATExecAddColumn(List** wqueue, AlteredTableInfo* tab, Relation rel,
attribute.attisdropped = false;
attribute.attislocal = colDef->is_local;
attribute.attkvtype = colDef->kvtype;
VerifyAttrCompressMode(colDef->cmprs_mode, attribute.attlen, colDef->colname);
attribute.attcmprmode = colDef->cmprs_mode;
if (!isDelta) {
VerifyAttrCompressMode(colDef->cmprs_mode, attribute.attlen, colDef->colname);
attribute.attcmprmode = colDef->cmprs_mode;
} else {
attribute.attcmprmode = ATT_CMPR_NOCOMPRESS;
}
attribute.attinhcount = colDef->inhcount;
attribute.attcollation = collOid;
/* attribute.attacl is handled by InsertPgAttributeTuple */
ReleaseSysCache(typeTuple);
if (RelationIsRowFormat(rel) && ATT_CMPR_NOCOMPRESS < colDef->cmprs_mode
if (!isDelta && RelationIsRowFormat(rel) && ATT_CMPR_NOCOMPRESS < colDef->cmprs_mode
&& colDef->cmprs_mode <= ATT_CMPR_NUMSTR) {
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),

View File

@ -19,4 +19,8 @@ CREATE TABLE cstore_cmpr_delta_macaddr
(
distkey INT4,
a1 macaddr
) with ( orientation = column, compression = low ) ;
) with ( orientation = column, compression = low ) ;
create table t_1093961(id int) with (orientation = column);
alter table t_1093961 add column score varchar prefix;
select attcmprmode from pg_attribute where attname = 'score' and attrelid in (select relfilenode from pg_class where relname = 't_1093961');
select attcmprmode from pg_attribute where attname = 'score' and attrelid in (select relfilenode from pg_class where relname in (select concat('pg_delta_', relfilenode) from (select relfilenode from pg_class where relname = 't_1093961')));

View File

@ -41,3 +41,17 @@ CREATE TABLE cstore_cmpr_delta_macaddr
a1 macaddr
) with ( orientation = column, compression = low ) ;
ERROR: type "macaddr" is not supported in column store
create table t_1093961(id int) with (orientation = column);
alter table t_1093961 add column score varchar prefix;
select attcmprmode from pg_attribute where attname = 'score' and attrelid in (select relfilenode from pg_class where relname = 't_1093961');
attcmprmode
-------------
3
(1 row)
select attcmprmode from pg_attribute where attname = 'score' and attrelid in (select relfilenode from pg_class where relname in (select concat('pg_delta_', relfilenode) from (select relfilenode from pg_class where relname = 't_1093961')));
attcmprmode
-------------
0
(1 row)