From: Robert Haas Date: Fri, 19 Mar 2021 21:17:48 +0000 (-0400) Subject: Fix use-after-ReleaseSysCache problem in ATExecAlterColumnType. X-Git-Tag: REL_14_BETA1~522 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d00fbdc431192c3e429b3e91c43d364e5c7ba680;p=thirdparty%2Fpostgresql.git Fix use-after-ReleaseSysCache problem in ATExecAlterColumnType. Introduced by commit bbe0a81db69bd10bd166907c3701492a29aca294. Per buildfarm member prion. --- diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index ab89935ba73..9b2800bf5e2 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -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);