Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 89d52b9

Browse files
committed
Free pre-modification HeapTuple in ALTER TABLE ... TYPE ...
This was an oversight in commit 3b174b1. Per offline gripe from Alvaro Herrera Backpatch to release 11.
1 parent 05eb923 commit 89d52b9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/commands/tablecmds.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9747,6 +9747,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
97479747
Datum valuesAtt[Natts_pg_attribute];
97489748
bool nullsAtt[Natts_pg_attribute];
97499749
bool replacesAtt[Natts_pg_attribute];
9750+
HeapTuple newTup;
97509751

97519752
MemSet(valuesAtt, 0, sizeof(valuesAtt));
97529753
MemSet(nullsAtt, false, sizeof(nullsAtt));
@@ -9772,8 +9773,10 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
97729773
replacesAtt[Anum_pg_attribute_attmissingval - 1] = true;
97739774
nullsAtt[Anum_pg_attribute_attmissingval - 1] = false;
97749775

9775-
heapTup = heap_modify_tuple(heapTup, RelationGetDescr(attrelation),
9776-
valuesAtt, nullsAtt, replacesAtt);
9776+
newTup = heap_modify_tuple(heapTup, RelationGetDescr(attrelation),
9777+
valuesAtt, nullsAtt, replacesAtt);
9778+
heap_freetuple(heapTup);
9779+
heapTup = newTup;
97779780
attTup = (Form_pg_attribute) GETSTRUCT(heapTup);
97789781
}
97799782
}

0 commit comments

Comments
 (0)