diff options
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 85dcc330638..11e91c4ad33 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -2640,8 +2640,8 @@ MergeAttributes(List *schema, List *supers, char relpersistence, def->constraints = NIL; def->location = -1; if (CompressionMethodIsValid(attribute->attcompression)) - def->compression = pstrdup(GetCompressionMethodName( - attribute->attcompression)); + def->compression = + pstrdup(GetCompressionMethodName(attribute->attcompression)); else def->compression = NULL; inhSchema = lappend(inhSchema, def); @@ -6596,12 +6596,19 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, attribute.atttypid = typeOid; attribute.attstattarget = (newattnum > 0) ? -1 : 0; attribute.attlen = tform->typlen; - attribute.atttypmod = typmod; attribute.attnum = newattnum; - attribute.attbyval = tform->typbyval; attribute.attndims = list_length(colDef->typeName->arrayBounds); - attribute.attstorage = tform->typstorage; + attribute.atttypmod = typmod; + attribute.attbyval = tform->typbyval; attribute.attalign = tform->typalign; + attribute.attstorage = tform->typstorage; + /* do not set compression in views etc */ + if (rel->rd_rel->relkind == RELKIND_RELATION || + rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) + attribute.attcompression = GetAttributeCompression(&attribute, + colDef->compression); + else + attribute.attcompression = InvalidCompressionMethod; attribute.attnotnull = colDef->is_not_null; attribute.atthasdef = false; attribute.atthasmissing = false; @@ -6612,17 +6619,6 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, attribute.attinhcount = colDef->inhcount; attribute.attcollation = collOid; - /* - * lookup attribute's compression method and store it in the - * attr->attcompression. - */ - if (rel->rd_rel->relkind == RELKIND_RELATION || - rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) - attribute.attcompression = GetAttributeCompression(&attribute, - colDef->compression); - else - attribute.attcompression = InvalidCompressionMethod; - /* attribute.attacl is handled by InsertPgAttributeTuples() */ ReleaseSysCache(typeTuple); |