Skip to content

Commit 0143d39

Browse files
Jan WieckJan Wieck
authored andcommitted
Need to switch to tuples memory context when replacing the toasted
one with the plain one. Jan
1 parent 82f3945 commit 0143d39

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backend/access/heap/heapam.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.80 2000/07/21 10:31:30 wieck Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.81 2000/07/21 11:18:51 wieck Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1360,7 +1360,11 @@ heap_insert(Relation relation, HeapTuple tup)
13601360
{
13611361
if (tup->t_datamcxt != NULL && (char *) (tup->t_data) !=
13621362
((char *) tup + HEAPTUPLESIZE))
1363+
{
1364+
MemoryContext oldcxt = MemoryContextSwitchTo(tup->t_datamcxt);
13631365
pfree(tup->t_data);
1366+
MemoryContextSwitchTo(oldcxt);
1367+
}
13641368
tup->t_data = plaintdata;
13651369
tup->t_len = plaintlen;
13661370
}
@@ -1672,7 +1676,11 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
16721676
{
16731677
if (newtup->t_datamcxt != NULL && (char *) (newtup->t_data) !=
16741678
((char *) newtup + HEAPTUPLESIZE))
1679+
{
1680+
MemoryContext oldcxt = MemoryContextSwitchTo(newtup->t_datamcxt);
16751681
pfree(newtup->t_data);
1682+
MemoryContextSwitchTo(oldcxt);
1683+
}
16761684
newtup->t_data = plaintdata;
16771685
newtup->t_len = plaintlen;
16781686
}

0 commit comments

Comments
 (0)