PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <math.h>
#include "access/htup_details.h"
#include "executor/executor.h"
#include "executor/nodeSubplan.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/optimizer.h"
#include "utils/array.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
Go to the source code of this file.
Functions | |
static Datum | ExecHashSubPlan (SubPlanState *node, ExprContext *econtext, bool *isNull) |
static Datum | ExecScanSubPlan (SubPlanState *node, ExprContext *econtext, bool *isNull) |
static void | buildSubPlanHash (SubPlanState *node, ExprContext *econtext) |
static bool | findPartialMatch (TupleHashTable hashtable, TupleTableSlot *slot, FmgrInfo *eqfunctions) |
static bool | slotAllNulls (TupleTableSlot *slot) |
static bool | slotNoNulls (TupleTableSlot *slot) |
Datum | ExecSubPlan (SubPlanState *node, ExprContext *econtext, bool *isNull) |
static bool | execTuplesUnequal (TupleTableSlot *slot1, TupleTableSlot *slot2, int numCols, AttrNumber *matchColIdx, FmgrInfo *eqfunctions, const Oid *collations, MemoryContext evalContext) |
SubPlanState * | ExecInitSubPlan (SubPlan *subplan, PlanState *parent) |
void | ExecSetParamPlan (SubPlanState *node, ExprContext *econtext) |
void | ExecSetParamPlanMulti (const Bitmapset *params, ExprContext *econtext) |
void | ExecReScanSetParamPlan (SubPlanState *node, PlanState *parent) |
|
static |
Definition at line 496 of file nodeSubplan.c.
References ANY_SUBLINK, Assert, BuildTupleHashTableExt(), clamp_cardinality_to_long(), SubPlanState::descRight, ExprContext::ecxt_param_exec_vals, ExprContext::ecxt_per_query_memory, EState::es_query_cxt, ExecClearTuple(), ParamExecData::execPlan, ExecProcNode(), ExecProject(), ExecReScan(), SubPlanState::hashnulls, SubPlanState::hashtable, SubPlanState::hashtablecxt, SubPlanState::hashtempcxt, SubPlanState::havehashrows, SubPlanState::havenullrows, SubPlanState::innerecontext, ParamExecData::isnull, SubPlanState::keyColIdx, lfirst_int, LookupTupleHashEntry(), MemoryContextReset(), MemoryContextSwitchTo(), SubPlanState::numCols, SubPlan::paramIds, SubPlanState::parent, ProjectionInfo::pi_state, PlanState::plan, Plan::plan_rows, SubPlanState::planstate, SubPlanState::projRight, ResetExprContext, ResetTupleHashTable(), ExprState::resultslot, slot_getattr(), slotNoNulls(), PlanState::state, SubPlan::subLinkType, SubPlanState::subplan, SubPlanState::tab_collations, SubPlanState::tab_eq_funcoids, SubPlanState::tab_hash_funcs, TupIsNull, SubPlan::unknownEqFalse, and ParamExecData::value.
Referenced by ExecHashSubPlan().
|
static |
Definition at line 101 of file nodeSubplan.c.
References SubPlan::args, BoolGetDatum(), buildSubPlanHash(), PlanState::chgParam, SubPlanState::cur_eq_comp, SubPlanState::cur_eq_funcs, elog, ERROR, ExecClearTuple(), ExecProject(), findPartialMatch(), FindTupleHashEntry(), SubPlanState::hashnulls, SubPlanState::hashtable, SubPlanState::havehashrows, SubPlanState::havenullrows, SubPlanState::lhs_hash_funcs, NIL, SubPlan::parParam, ProjectionInfo::pi_exprContext, SubPlanState::planstate, SubPlanState::projLeft, slotAllNulls(), slotNoNulls(), and SubPlanState::subplan.
Referenced by ExecSubPlan().
SubPlanState* ExecInitSubPlan | ( | SubPlan * | subplan, |
PlanState * | parent | ||
) |
Definition at line 819 of file nodeSubplan.c.
References ALLOCSET_DEFAULT_SIZES, ALLOCSET_SMALL_SIZES, AllocSetContextCreate, OpExpr::args, Assert, castNode, CreateExprContext(), CTE_SUBLINK, SubPlanState::cur_eq_comp, SubPlanState::cur_eq_funcs, SubPlanState::curArray, CurrentMemoryContext, SubPlanState::curTuple, SubPlanState::descRight, elog, ERROR, EState::es_param_exec_vals, EState::es_subplanstates, ExecBuildGroupingEqual(), ExecBuildProjectionInfo(), ExecInitExpr(), ExecInitExtraTupleSlot(), ParamExecData::execPlan, ExecTypeFromTL(), fmgr_info(), fmgr_info_set_expr, get_compatible_hash_operators(), get_op_hash_functions(), get_opcode(), SubPlanState::hashnulls, SubPlanState::hashtable, SubPlanState::hashtablecxt, SubPlanState::hashtempcxt, i, SubPlanState::innerecontext, is_andclause(), IsA, SubPlanState::keyColIdx, lappend(), lfirst_int, lfirst_node, SubPlanState::lhs_hash_funcs, linitial, list_length(), list_make1, list_nth(), lsecond, makeNode, makeTargetEntry(), NIL, nodeTag, SubPlanState::numCols, OpExpr::opno, palloc(), SubPlanState::parent, SubPlan::parParam, SubPlan::plan_id, SubPlan::plan_name, SubPlanState::planstate, PointerGetDatum(), SubPlanState::projLeft, SubPlanState::projRight, SubPlan::setParam, PlanState::state, SubPlan::subLinkType, SubPlanState::subplan, SubPlanState::tab_collations, SubPlanState::tab_eq_funcoids, SubPlanState::tab_hash_funcs, SubPlanState::testexpr, SubPlan::testexpr, TTSOpsMinimalTuple, TTSOpsVirtual, and SubPlan::useHashTable.
Referenced by ExecInitNode(), and ExecInitSubPlanExpr().
void ExecReScanSetParamPlan | ( | SubPlanState * | node, |
PlanState * | parent | ||
) |
Definition at line 1282 of file nodeSubplan.c.
References bms_add_member(), bms_is_empty, PlanState::chgParam, CTE_SUBLINK, elog, ERROR, EState::es_param_exec_vals, ParamExecData::execPlan, Plan::extParam, lfirst_int, NIL, SubPlan::parParam, PlanState::plan, SubPlanState::planstate, SubPlan::setParam, PlanState::state, SubPlan::subLinkType, and SubPlanState::subplan.
Referenced by ExecReScan().
|
static |
Definition at line 223 of file nodeSubplan.c.
References accumArrayResultAny(), ALL_SUBLINK, ANY_SUBLINK, ARRAY_SUBLINK, Assert, bms_add_member(), BoolGetDatum(), PlanState::chgParam, CurrentMemoryContext, SubPlanState::curTuple, DatumGetBool(), ExprContext::ecxt_param_exec_vals, ExprContext::ecxt_per_query_memory, ereport, errcode(), errmsg(), ERROR, ExecCopySlotHeapTuple(), ExecEvalExprSwitchContext(), ParamExecData::execPlan, ExecProcNode(), ExecReScan(), EXISTS_SUBLINK, EXPR_SUBLINK, SubPlan::firstColType, heap_freetuple(), heap_getattr(), initArrayResultAny(), ParamExecData::isnull, lfirst_int, makeArrayResultAny(), MemoryContextSwitchTo(), MULTIEXPR_SUBLINK, SubPlan::paramIds, SubPlan::parParam, SubPlanState::planstate, ROWCOMPARE_SUBLINK, SubPlan::setParam, slot_getattr(), SubPlan::subLinkType, SubPlanState::subplan, SubPlanState::testexpr, TupleTableSlot::tts_tupleDescriptor, TupIsNull, TupleDescAttr, and ParamExecData::value.
Referenced by ExecSubPlan().
void ExecSetParamPlan | ( | SubPlanState * | node, |
ExprContext * | econtext | ||
) |
Definition at line 1083 of file nodeSubplan.c.
References accumArrayResultAny(), ALL_SUBLINK, ANY_SUBLINK, SubPlan::args, ARRAY_SUBLINK, Assert, BoolGetDatum(), CTE_SUBLINK, SubPlanState::curArray, CurrentMemoryContext, SubPlanState::curTuple, DatumGetPointer(), ExprContext::ecxt_param_exec_vals, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, EState::es_direction, ExecCopySlotHeapTuple(), ParamExecData::execPlan, ExecProcNode(), EXISTS_SUBLINK, EXPR_SUBLINK, SubPlan::firstColType, ForwardScanDirection, heap_freetuple(), heap_getattr(), i, initArrayResultAny(), ParamExecData::isnull, lfirst_int, linitial_int, makeArrayResultAny(), MemoryContextSwitchTo(), MULTIEXPR_SUBLINK, SubPlan::parParam, pfree(), SubPlanState::planstate, PointerGetDatum(), ROWCOMPARE_SUBLINK, SubPlan::setParam, slot_getattr(), PlanState::state, SubPlan::subLinkType, SubPlanState::subplan, TupleTableSlot::tts_tupleDescriptor, TupIsNull, TupleDescAttr, and ParamExecData::value.
Referenced by ExecEvalParamExec(), and ExecSetParamPlanMulti().
void ExecSetParamPlanMulti | ( | const Bitmapset * | params, |
ExprContext * | econtext | ||
) |
Definition at line 1259 of file nodeSubplan.c.
References Assert, bms_next_member(), ExprContext::ecxt_param_exec_vals, ParamExecData::execPlan, and ExecSetParamPlan().
Referenced by EvalPlanQualBegin(), EvalPlanQualStart(), ExecInitParallelPlan(), and ExecParallelReinitialize().
Datum ExecSubPlan | ( | SubPlanState * | node, |
ExprContext * | econtext, | ||
bool * | isNull | ||
) |
Definition at line 62 of file nodeSubplan.c.
References CHECK_FOR_INTERRUPTS, CTE_SUBLINK, elog, ERROR, EState::es_direction, ExecHashSubPlan(), ExecScanSubPlan(), ForwardScanDirection, MULTIEXPR_SUBLINK, NIL, SubPlanState::planstate, SubPlan::setParam, PlanState::state, SubPlan::subLinkType, SubPlanState::subplan, and SubPlan::useHashTable.
Referenced by ExecEvalSubPlan().
|
static |
Definition at line 667 of file nodeSubplan.c.
References DatumGetBool(), FunctionCall2Coll(), i, MemoryContextReset(), MemoryContextSwitchTo(), and slot_getattr().
Referenced by findPartialMatch().
|
static |
Definition at line 736 of file nodeSubplan.c.
References CHECK_FOR_INTERRUPTS, ExecStoreMinimalTuple(), execTuplesUnequal(), TupleHashEntryData::firstTuple, InitTupleHashIterator, TupleHashTableData::keyColIdx, TupleHashTableData::numCols, ScanTupleHashTable, TupleHashTableData::tab_collations, TupleHashTableData::tableslot, TupleHashTableData::tempcxt, and TermTupleHashIterator.
Referenced by ExecHashSubPlan().
|
static |
Definition at line 771 of file nodeSubplan.c.
References i, TupleDescData::natts, slot_attisnull(), and TupleTableSlot::tts_tupleDescriptor.
Referenced by ExecHashSubPlan().
|
static |
Definition at line 791 of file nodeSubplan.c.
References i, TupleDescData::natts, slot_attisnull(), and TupleTableSlot::tts_tupleDescriptor.
Referenced by buildSubPlanHash(), and ExecHashSubPlan().