diff options
Diffstat (limited to 'src/backend/executor/execTuples.c')
-rw-r--r-- | src/backend/executor/execTuples.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c index 357d99e36fc..7d92f8deff4 100644 --- a/src/backend/executor/execTuples.c +++ b/src/backend/executor/execTuples.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.102 2008/08/25 22:42:32 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.103 2008/10/28 22:02:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -767,6 +767,33 @@ ExecFetchSlotMinimalTuple(TupleTableSlot *slot) } /* -------------------------------- + * ExecFetchSlotTupleDatum + * Fetch the slot's tuple as a composite-type Datum. + * + * We convert the slot's contents to local physical-tuple form, + * and fill in the Datum header fields. Note that the result + * always points to storage owned by the slot. + * -------------------------------- + */ +Datum +ExecFetchSlotTupleDatum(TupleTableSlot *slot) +{ + HeapTuple tup; + HeapTupleHeader td; + TupleDesc tupdesc; + + /* Make sure we can scribble on the slot contents ... */ + tup = ExecMaterializeSlot(slot); + /* ... and set up the composite-Datum header fields, in case not done */ + td = tup->t_data; + tupdesc = slot->tts_tupleDescriptor; + HeapTupleHeaderSetDatumLength(td, tup->t_len); + HeapTupleHeaderSetTypeId(td, tupdesc->tdtypeid); + HeapTupleHeaderSetTypMod(td, tupdesc->tdtypmod); + return PointerGetDatum(td); +} + +/* -------------------------------- * ExecMaterializeSlot * Force a slot into the "materialized" state. * |