Commit 0143d391 authored by Jan Wieck's avatar Jan Wieck

Need to switch to tuples memory context when replacing the toasted

one with the plain one.

Jan
parent 82f3945a
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.80 2000/07/21 10:31:30 wieck Exp $ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.81 2000/07/21 11:18:51 wieck Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -1360,7 +1360,11 @@ heap_insert(Relation relation, HeapTuple tup) ...@@ -1360,7 +1360,11 @@ heap_insert(Relation relation, HeapTuple tup)
{ {
if (tup->t_datamcxt != NULL && (char *) (tup->t_data) != if (tup->t_datamcxt != NULL && (char *) (tup->t_data) !=
((char *) tup + HEAPTUPLESIZE)) ((char *) tup + HEAPTUPLESIZE))
{
MemoryContext oldcxt = MemoryContextSwitchTo(tup->t_datamcxt);
pfree(tup->t_data); pfree(tup->t_data);
MemoryContextSwitchTo(oldcxt);
}
tup->t_data = plaintdata; tup->t_data = plaintdata;
tup->t_len = plaintlen; tup->t_len = plaintlen;
} }
...@@ -1672,7 +1676,11 @@ l2: ...@@ -1672,7 +1676,11 @@ l2:
{ {
if (newtup->t_datamcxt != NULL && (char *) (newtup->t_data) != if (newtup->t_datamcxt != NULL && (char *) (newtup->t_data) !=
((char *) newtup + HEAPTUPLESIZE)) ((char *) newtup + HEAPTUPLESIZE))
{
MemoryContext oldcxt = MemoryContextSwitchTo(newtup->t_datamcxt);
pfree(newtup->t_data); pfree(newtup->t_data);
MemoryContextSwitchTo(oldcxt);
}
newtup->t_data = plaintdata; newtup->t_data = plaintdata;
newtup->t_len = plaintlen; newtup->t_len = plaintlen;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment