diff options
author | Andres Freund <andres@anarazel.de> | 2018-11-16 16:35:11 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2018-11-16 16:35:15 -0800 |
commit | 4da597edf1bae0cf0453b5ed6fc4347b6334dfe1 (patch) | |
tree | 1311627bcb3c21c15d3bed719b16bf5254289e93 /src/backend/executor/execExprInterp.c | |
parent | 0201d79a5549e3375ea5e5aee351378399453f15 (diff) | |
download | postgresql-4da597edf1bae0cf0453b5ed6fc4347b6334dfe1.tar.gz postgresql-4da597edf1bae0cf0453b5ed6fc4347b6334dfe1.zip |
Make TupleTableSlots extensible, finish split of existing slot type.
This commit completes the work prepared in 1a0586de36, splitting the
old TupleTableSlot implementation (which could store buffer, heap,
minimal and virtual slots) into four different slot types. As
described in the aforementioned commit, this is done with the goal of
making tuple table slots extensible, to allow for pluggable table
access methods.
To achieve runtime extensibility for TupleTableSlots, operations on
slots that can differ between types of slots are performed using the
TupleTableSlotOps struct provided at slot creation time. That
includes information from the size of TupleTableSlot struct to be
allocated, initialization, deforming etc. See the struct's definition
for more detailed information about callbacks TupleTableSlotOps.
I decided to rename TTSOpsBufferTuple to TTSOpsBufferHeapTuple and
ExecCopySlotTuple to ExecCopySlotHeapTuple, as that seems more
consistent with other naming introduced in recent patches.
There's plenty optimization potential in the slot implementation, but
according to benchmarking the state after this commit has similar
performance characteristics to before this set of changes, which seems
sufficient.
There's a few changes in execReplication.c that currently need to poke
through the slot abstraction, that'll be repaired once the pluggable
storage patchset provides the necessary infrastructure.
Author: Andres Freund and Ashutosh Bapat, with changes by Amit Khandekar
Discussion: https://postgr.es/m/20181105210039.hh4vvi4vwoq5ba2q@alap3.anarazel.de
Diffstat (limited to 'src/backend/executor/execExprInterp.c')
-rw-r--r-- | src/backend/executor/execExprInterp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index 1f9f583cfbb..ec4a2506f15 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -1875,11 +1875,11 @@ CheckOpSlotCompatibility(ExprEvalStep *op, TupleTableSlot *slot) * Should probably fixed at some point, but for now it's easier to allow * buffer and heap tuples to be used interchangably. */ - if (slot->tts_ops == &TTSOpsBufferTuple && + if (slot->tts_ops == &TTSOpsBufferHeapTuple && op->d.fetch.kind == &TTSOpsHeapTuple) return; if (slot->tts_ops == &TTSOpsHeapTuple && - op->d.fetch.kind == &TTSOpsBufferTuple) + op->d.fetch.kind == &TTSOpsBufferHeapTuple) return; /* @@ -4025,15 +4025,15 @@ void ExecEvalSysVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext, TupleTableSlot *slot) { - bool success; + Datum d; /* slot_getsysattr has sufficient defenses against bad attnums */ - success = slot_getsysattr(slot, - op->d.var.attnum, - op->resvalue, - op->resnull); + d = slot_getsysattr(slot, + op->d.var.attnum, + op->resnull); + *op->resvalue = d; /* this ought to be unreachable, but it's cheap enough to check */ - if (unlikely(!success)) + if (unlikely(*op->resnull)) elog(ERROR, "failed to fetch attribute from slot"); } |