Fix use-after-ReleaseSysCache problem in ATExecAlterColumnType.

Introduced by commit bbe0a81db6.

Per buildfarm member prion.
This commit is contained in:
Robert Haas 2021-03-19 17:17:48 -04:00
parent bbe0a81db6
commit d00fbdc431
1 changed files with 2 additions and 2 deletions

View File

@ -11953,8 +11953,6 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
attTup->attalign = tform->typalign;
attTup->attstorage = tform->typstorage;
ReleaseSysCache(typeTuple);
/* Setup attribute compression */
if (rel->rd_rel->relkind == RELKIND_RELATION ||
rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
@ -11972,6 +11970,8 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
else
attTup->attcompression = InvalidCompressionMethod;
ReleaseSysCache(typeTuple);
CatalogTupleUpdate(attrelation, &heapTup->t_self, heapTup);
table_close(attrelation, RowExclusiveLock);