diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-29 00:39:20 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-29 00:39:20 +0000 |
commit | 0d54d6ac44444c05f7c0f5058d3d3f32cc188b48 (patch) | |
tree | cccee5d61e1afc1982c363ed3e4876a09ed82b52 /src/backend/executor/execQual.c | |
parent | 51cd0377460839d25a5fc5f2a2499de43126a3b2 (diff) | |
download | postgresql-0d54d6ac44444c05f7c0f5058d3d3f32cc188b48.tar.gz postgresql-0d54d6ac44444c05f7c0f5058d3d3f32cc188b48.zip |
Clean up handling of tuple descriptors so that result-tuple descriptors
allocated by plan nodes are not leaked at end of query. This doesn't
really matter for normal queries, but it sure does for queries invoked
repetitively inside SQL functions. Clean up some other grotty code
associated with tupdescs, and fix a few other memory leaks exposed by
tests with simple SQL functions.
Diffstat (limited to 'src/backend/executor/execQual.c')
-rw-r--r-- | src/backend/executor/execQual.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index f0721f57bd5..bab2851df9d 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.82 2001/01/24 19:42:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.83 2001/01/29 00:39:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -328,25 +328,19 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull) /* * If the attribute number is invalid, then we are supposed to return * the entire tuple, we give back a whole slot so that callers know - * what the tuple looks like. + * what the tuple looks like. XXX why copy? Couldn't we just give + * back the existing slot? */ if (attnum == InvalidAttrNumber) { - TupleTableSlot *tempSlot; + TupleTableSlot *tempSlot = MakeTupleTableSlot(); TupleDesc td; HeapTuple tup; - tempSlot = makeNode(TupleTableSlot); - tempSlot->ttc_shouldFree = false; - tempSlot->ttc_descIsNew = true; - tempSlot->ttc_tupleDescriptor = (TupleDesc) NULL; - tempSlot->ttc_buffer = InvalidBuffer; - tup = heap_copytuple(heapTuple); td = CreateTupleDescCopy(tuple_type); - ExecSetSlotDescriptor(tempSlot, td); - + ExecSetSlotDescriptor(tempSlot, td, true); ExecStoreTuple(tup, tempSlot, InvalidBuffer, true); return PointerGetDatum(tempSlot); } |