Skip to content

Commit e33884d

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 1db5667 commit e33884d

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
@@ -9648,6 +9648,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
96489648
Datum valuesAtt[Natts_pg_attribute];
96499649
bool nullsAtt[Natts_pg_attribute];
96509650
bool replacesAtt[Natts_pg_attribute];
9651+
HeapTuple newTup;
96519652

96529653
MemSet(valuesAtt, 0, sizeof(valuesAtt));
96539654
MemSet(nullsAtt, false, sizeof(nullsAtt));
@@ -9673,8 +9674,10 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
96739674
replacesAtt[Anum_pg_attribute_attmissingval - 1] = true;
96749675
nullsAtt[Anum_pg_attribute_attmissingval - 1] = false;
96759676

9676-
heapTup = heap_modify_tuple(heapTup, RelationGetDescr(attrelation),
9677-
valuesAtt, nullsAtt, replacesAtt);
9677+
newTup = heap_modify_tuple(heapTup, RelationGetDescr(attrelation),
9678+
valuesAtt, nullsAtt, replacesAtt);
9679+
heap_freetuple(heapTup);
9680+
heapTup = newTup;
96789681
attTup = (Form_pg_attribute) GETSTRUCT(heapTup);
96799682
}
96809683
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy