aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execQual.c
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2008-03-25 19:26:54 +0000
committerNeil Conway <neilc@samurai.com>2008-03-25 19:26:54 +0000
commit1d812a98b47da94ad274dcac682c5d2c014aae16 (patch)
tree6d4b51db76796e3dd7a59e7b18432bf179fe89ad /src/backend/executor/execQual.c
parent76cf067ae40d5f8c4bf95954726e0067131da84b (diff)
downloadpostgresql-1d812a98b47da94ad274dcac682c5d2c014aae16.tar.gz
postgresql-1d812a98b47da94ad274dcac682c5d2c014aae16.zip
Add a new tuplestore API function, tuplestore_putvalues(). This is
identical to tuplestore_puttuple(), except it operates on arrays of Datums + nulls rather than a fully-formed HeapTuple. In several places that use the tuplestore API, this means we can avoid creating a HeapTuple altogether, saving a copy.
Diffstat (limited to 'src/backend/executor/execQual.c')
-rw-r--r--src/backend/executor/execQual.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 6e7daa40e8f..97d22dc2cd3 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.226 2008/01/01 19:45:49 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.227 2008/03/25 19:26:53 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1547,7 +1547,6 @@ ExecMakeTableFunctionResult(ExprState *funcexpr,
for (;;)
{
Datum result;
- HeapTuple tuple;
CHECK_FOR_INTERRUPTS();
@@ -1649,15 +1648,15 @@ ExecMakeTableFunctionResult(ExprState *funcexpr,
*/
tmptup.t_len = HeapTupleHeaderGetDatumLength(td);
tmptup.t_data = td;
- tuple = &tmptup;
+
+ oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
+ tuplestore_puttuple(tupstore, &tmptup);
}
else
{
- tuple = heap_form_tuple(tupdesc, &result, &fcinfo.isnull);
+ oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
+ tuplestore_putvalues(tupstore, tupdesc, &result, &fcinfo.isnull);
}
-
- oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
- tuplestore_puttuple(tupstore, tuple);
MemoryContextSwitchTo(oldcontext);
/*
@@ -1702,15 +1701,13 @@ no_function_result:
int natts = expectedDesc->natts;
Datum *nulldatums;
bool *nullflags;
- HeapTuple tuple;
MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
nulldatums = (Datum *) palloc0(natts * sizeof(Datum));
nullflags = (bool *) palloc(natts * sizeof(bool));
memset(nullflags, true, natts * sizeof(bool));
- tuple = heap_form_tuple(expectedDesc, nulldatums, nullflags);
MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
- tuplestore_puttuple(tupstore, tuple);
+ tuplestore_putvalues(tupstore, expectedDesc, nulldatums, nullflags);
}
}