|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/parallel.h"#include "access/table.h"#include "access/tableam.h"#include "access/tupconvert.h"#include "executor/executor.h"#include "executor/nodeModifyTable.h"#include "jit/jit.h"#include "mb/pg_wchar.h"#include "miscadmin.h"#include "parser/parse_relation.h"#include "partitioning/partdesc.h"#include "port/pg_bitutils.h"#include "storage/lmgr.h"#include "utils/builtins.h"#include "utils/memutils.h"#include "utils/rel.h"#include "utils/typcache.h"
Go to the source code of this file.
Definition at line 90 of file execUtils.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, CurrentMemoryContext, EState::es_auxmodifytables, EState::es_crosscheck_snapshot, EState::es_direction, EState::es_exprcontexts, EState::es_finished, EState::es_insert_pending_modifytables, EState::es_insert_pending_result_relations, EState::es_instrument, EState::es_jit, EState::es_jit_flags, EState::es_junkFilter, EState::es_opened_result_relations, EState::es_output_cid, EState::es_parallel_workers_launched, EState::es_parallel_workers_to_launch, EState::es_param_exec_vals, EState::es_param_list_info, EState::es_part_prune_infos, EState::es_part_prune_results, EState::es_part_prune_states, EState::es_per_tuple_exprcontext, EState::es_plannedstmt, EState::es_processed, EState::es_query_cxt, EState::es_queryEnv, EState::es_range_table, EState::es_range_table_size, EState::es_relations, EState::es_result_relations, EState::es_rowmarks, EState::es_rteperminfos, EState::es_snapshot, EState::es_sourceText, EState::es_subplanstates, EState::es_top_eflags, EState::es_total_processed, EState::es_trig_target_relations, EState::es_tuple_routing_result_relations, EState::es_tupleTable, EState::es_unpruned_relids, EState::es_use_parallel_mode, fb(), ForwardScanDirection, InvalidSnapshot, makeNode, MemoryContextSwitchTo(), and NIL.
Referenced by afterTriggerInvokeEvents(), ATExecAddColumn(), ATRewriteTable(), check_default_partition_contents(), compute_expr_stats(), compute_index_stats(), CopyFrom(), create_edata_for_relation(), create_estate_for_relation(), EvalPlanQualStart(), evaluate_expr(), ExecuteCallStmt(), ExecuteQuery(), ExecuteTruncateGuts(), ExplainExecuteQuery(), fileIterateForeignScan(), get_qual_for_range(), heapam_index_build_range_scan(), heapam_index_validate_scan(), IndexCheckExclusion(), make_build_data(), MergePartitionsMoveRows(), operator_predicate_proof(), plpgsql_create_econtext(), plpgsql_inline_handler(), SplitPartitionMoveRows(), standard_ExecutorStart(), tuplesort_begin_cluster(), unique_key_recheck(), and validateDomainCheckConstraint().
| ExprContext * CreateExprContext | ( | EState * | estate | ) |
Definition at line 312 of file execUtils.c.
References ALLOCSET_DEFAULT_SIZES, and CreateExprContextInternal().
Referenced by CreatePartitionPruneState(), ExecAssignExprContext(), ExecInitMergeJoin(), ExecInitSubPlan(), ExecuteCallStmt(), MakePerTupleExprContext(), and plpgsql_create_econtext().
|
static |
Definition at line 242 of file execUtils.c.
References AllocSetContextCreate, ExprContext::caseValue_datum, ExprContext::caseValue_isNull, ExprContext::domainValue_datum, ExprContext::domainValue_isNull, ExprContext::ecxt_aggnulls, ExprContext::ecxt_aggvalues, ExprContext::ecxt_callbacks, ExprContext::ecxt_estate, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, ExprContext::ecxt_param_exec_vals, ExprContext::ecxt_param_list_info, ExprContext::ecxt_per_query_memory, ExprContext::ecxt_per_tuple_memory, ExprContext::ecxt_scantuple, EState::es_exprcontexts, EState::es_param_exec_vals, EState::es_param_list_info, EState::es_query_cxt, fb(), lcons(), makeNode, and MemoryContextSwitchTo().
Referenced by CreateExprContext(), and CreateWorkExprContext().
| ExprContext * CreateStandaloneExprContext | ( | void | ) |
Definition at line 362 of file execUtils.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, ExprContext::caseValue_datum, ExprContext::caseValue_isNull, CurrentMemoryContext, ExprContext::domainValue_datum, ExprContext::domainValue_isNull, ExprContext::ecxt_aggnulls, ExprContext::ecxt_aggvalues, ExprContext::ecxt_callbacks, ExprContext::ecxt_estate, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, ExprContext::ecxt_param_exec_vals, ExprContext::ecxt_param_list_info, ExprContext::ecxt_per_query_memory, ExprContext::ecxt_per_tuple_memory, ExprContext::ecxt_scantuple, fb(), and makeNode.
Referenced by BuildTupleHashTable(), domain_check_input(), and hypothetical_dense_rank_final().
| ExprContext * CreateWorkExprContext | ( | EState * | estate | ) |
Definition at line 327 of file execUtils.c.
References ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, ALLOCSET_DEFAULT_MINSIZE, CreateExprContextInternal(), Max, Min, pg_prevpower2_size_t, and work_mem.
Referenced by hash_create_memory().
Definition at line 490 of file execUtils.c.
References CreateExprContext(), and PlanState::ps_ExprContext.
Referenced by ExecInitAgg(), ExecInitBitmapHeapScan(), ExecInitBitmapIndexScan(), ExecInitCteScan(), ExecInitCustomScan(), ExecInitForeignScan(), ExecInitFunctionScan(), ExecInitGather(), ExecInitGatherMerge(), ExecInitGroup(), ExecInitHash(), ExecInitHashJoin(), ExecInitIndexOnlyScan(), ExecInitIndexScan(), ExecInitInsertProjection(), ExecInitLimit(), ExecInitMemoize(), ExecInitMerge(), ExecInitMergeJoin(), ExecInitModifyTable(), ExecInitNamedTuplestoreScan(), ExecInitNestLoop(), ExecInitProjectSet(), ExecInitResult(), ExecInitSampleScan(), ExecInitSeqScan(), ExecInitSetOp(), ExecInitSubqueryScan(), ExecInitTableFuncScan(), ExecInitTidRangeScan(), ExecInitTidScan(), ExecInitUnique(), ExecInitUpdateProjection(), ExecInitValuesScan(), ExecInitWindowAgg(), and ExecInitWorkTableScan().
Definition at line 588 of file execUtils.c.
References ExecBuildProjectionInfo(), fb(), PlanState::plan, PlanState::ps_ExprContext, PlanState::ps_ProjInfo, PlanState::ps_ResultTupleSlot, and Plan::targetlist.
Referenced by ExecConditionalAssignProjectionInfo(), ExecInitAgg(), ExecInitGroup(), ExecInitHashJoin(), ExecInitMergeJoin(), ExecInitNestLoop(), ExecInitResult(), and ExecInitWindowAgg().
Definition at line 697 of file execUtils.c.
References ExecSetSlotDescriptor(), and fb().
Referenced by ExecWorkTableScan().
Definition at line 1190 of file execUtils.c.
References fb(), len, and lfirst_node.
Referenced by ApplyRetrieveRule(), check_sql_stmt_retval(), and ExecTypeFromTLInternal().
Definition at line 608 of file execUtils.c.
References ExecAssignProjectionInfo(), ExecInitResultSlot(), fb(), PlanState::plan, PlanState::ps_ProjInfo, PlanState::ps_ResultTupleSlot, PlanState::resultops, PlanState::resultopsfixed, PlanState::resultopsset, PlanState::scanops, PlanState::scanopsfixed, PlanState::scanopsset, Plan::targetlist, tlist_matches_tupdesc(), and TTSOpsVirtual.
Referenced by ExecAssignScanProjectionInfo(), ExecAssignScanProjectionInfoWithVarno(), ExecInitGather(), and ExecInitGatherMerge().
| void ExecCreateScanSlotFromOuterPlan | ( | EState * | estate, |
| ScanState * | scanstate, | ||
| const TupleTableSlotOps * | tts_ops | ||
| ) |
Definition at line 709 of file execUtils.c.
References ExecGetResultType(), ExecInitScanTupleSlot(), fb(), outerPlan, and outerPlanState.
Referenced by ExecInitAgg(), ExecInitGroup(), ExecInitIncrementalSort(), ExecInitMaterial(), ExecInitMemoize(), ExecInitSort(), and ExecInitWindowAgg().
| TupleTableSlot * ExecGetAllNullSlot | ( | EState * | estate, |
| ResultRelInfo * | relInfo | ||
| ) |
Definition at line 1278 of file execUtils.c.
References EState::es_query_cxt, ExecInitExtraTupleSlot(), ExecStoreAllNullTuple(), fb(), MemoryContextSwitchTo(), RelationGetDescr, and table_slot_callbacks().
Referenced by ExecProcessReturning().
| Bitmapset * ExecGetAllUpdatedCols | ( | ResultRelInfo * | relinfo, |
| EState * | estate | ||
| ) |
Definition at line 1423 of file execUtils.c.
References bms_union(), ExecGetExtraUpdatedCols(), ExecGetUpdatedCols(), fb(), GetPerTupleMemoryContext, and MemoryContextSwitchTo().
Referenced by ExecARUpdateTriggers(), ExecASUpdateTriggers(), ExecBRUpdateTriggers(), ExecBSUpdateTriggers(), and ExecUpdateLockMode().
| TupleConversionMap * ExecGetChildToRootMap | ( | ResultRelInfo * | resultRelInfo | ) |
Definition at line 1305 of file execUtils.c.
References convert_tuples_by_name(), fb(), RelationGetDescr, ResultRelInfo::ri_ChildToRootMap, ResultRelInfo::ri_ChildToRootMapValid, ResultRelInfo::ri_RelationDesc, and ResultRelInfo::ri_RootResultRelInfo.
Referenced by adjust_partition_colnos(), AfterTriggerExecute(), AfterTriggerSaveEvent(), ExecCrossPartitionUpdate(), ExecDelete(), and TransitionTableAddTuple().
| const TupleTableSlotOps * ExecGetCommonChildSlotOps | ( | PlanState * | ps | ) |
Definition at line 568 of file execUtils.c.
References ExecGetCommonSlotOps(), fb(), innerPlanState, outerPlanState, and ps.
Referenced by build_hash_table(), and build_hash_table().
| const TupleTableSlotOps * ExecGetCommonSlotOps | ( | PlanState ** | planstates, |
| int | nplans | ||
| ) |
Definition at line 541 of file execUtils.c.
References ExecGetResultSlotOps(), fb(), and i.
Referenced by ExecGetCommonChildSlotOps(), ExecInitAppend(), and ExecInitMergeAppend().
| Bitmapset * ExecGetExtraUpdatedCols | ( | ResultRelInfo * | relinfo, |
| EState * | estate | ||
| ) |
Definition at line 1408 of file execUtils.c.
References CMD_UPDATE, ExecInitGenerated(), and fb().
Referenced by ExecGetAllUpdatedCols(), and index_unchanged_by_update().
| Bitmapset * ExecGetInsertedCols | ( | ResultRelInfo * | relinfo, |
| EState * | estate | ||
| ) |
Definition at line 1366 of file execUtils.c.
References TupleConversionMap::attrMap, ExecGetRootToChildMap(), execute_attr_map_cols(), fb(), and GetResultRTEPermissionInfo().
Referenced by ExecConstraints(), ExecPartitionCheckEmitError(), ExecWithCheckOptions(), get_tuple_desc(), and ReportNotNullViolationError().
Definition at line 830 of file execUtils.c.
References AccessShareLock, Assert, bms_is_member(), CheckRelationLockedByMe(), elog, ERROR, EState::es_relations, EState::es_unpruned_relids, exec_rt_fetch(), fb(), IsParallelWorker, NoLock, RTE_RELATION, and table_open().
Referenced by CreatePartitionPruneState(), ExecInitResultRelation(), ExecOpenScanRelation(), and InitPlan().
| Oid ExecGetResultRelCheckAsUser | ( | ResultRelInfo * | relInfo, |
| EState * | estate | ||
| ) |
Definition at line 1494 of file execUtils.c.
References elog, ERROR, fb(), GetResultRTEPermissionInfo(), GetUserId(), and RelationGetRelid.
Referenced by create_foreign_modify().
| const TupleTableSlotOps * ExecGetResultSlotOps | ( | PlanState * | planstate, |
| bool * | isfixed | ||
| ) |
Definition at line 509 of file execUtils.c.
References PlanState::ps_ResultTupleSlot, PlanState::resultops, PlanState::resultopsfixed, PlanState::resultopsset, TTS_FIXED, TupleTableSlot::tts_ops, and TTSOpsVirtual.
Referenced by ExecComputeSlotInfo(), ExecGetCommonSlotOps(), ExecInitAgg(), ExecInitGroup(), ExecInitHashJoin(), ExecInitLimit(), ExecInitLockRows(), ExecInitMergeJoin(), and ExecInitSubqueryScan().
Definition at line 500 of file execUtils.c.
References PlanState::ps_ResultTupleDesc.
Referenced by build_hash_table(), build_hash_table(), ExecComputeSlotInfo(), ExecCreateScanSlotFromOuterPlan(), ExecIncrementalSort(), ExecInitCteScan(), ExecInitGather(), ExecInitGatherMerge(), ExecInitGroup(), ExecInitHashJoin(), ExecInitIncrementalSort(), ExecInitLimit(), ExecInitMergeJoin(), ExecInitNestLoop(), ExecInitSort(), ExecInitSubqueryScan(), ExecInitUnique(), ExecSort(), ExecWorkTableScan(), initialize_phase(), InitPlan(), and switchToPresortedPrefixMode().
| TupleTableSlot * ExecGetReturningSlot | ( | EState * | estate, |
| ResultRelInfo * | relInfo | ||
| ) |
Definition at line 1253 of file execUtils.c.
References EState::es_query_cxt, ExecInitExtraTupleSlot(), fb(), MemoryContextSwitchTo(), RelationGetDescr, and table_slot_callbacks().
Referenced by apply_returning_filter(), ExecDelete(), and ExecInsert().
| TupleConversionMap * ExecGetRootToChildMap | ( | ResultRelInfo * | resultRelInfo, |
| EState * | estate | ||
| ) |
Definition at line 1331 of file execUtils.c.
References Assert, build_attrmap_by_name_if_req(), convert_tuples_by_name_attrmap(), EState::es_query_cxt, fb(), MemoryContextSwitchTo(), RelationGetDescr, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_RootResultRelInfo, ResultRelInfo::ri_RootToChildMap, and ResultRelInfo::ri_RootToChildMapValid.
Referenced by apply_handle_tuple_routing(), CopyFrom(), ExecFindPartition(), ExecGetInsertedCols(), ExecGetUpdatedCols(), ExecInitPartitionInfo(), ExecInitRoutingInfo(), ExecInsert(), and ExecPrepareTupleRouting().
| TupleTableSlot * ExecGetTriggerNewSlot | ( | EState * | estate, |
| ResultRelInfo * | relInfo | ||
| ) |
Definition at line 1231 of file execUtils.c.
References EState::es_query_cxt, ExecInitExtraTupleSlot(), fb(), MemoryContextSwitchTo(), RelationGetDescr, and table_slot_callbacks().
Referenced by AfterTriggerExecute(), and AfterTriggerSaveEvent().
| TupleTableSlot * ExecGetTriggerOldSlot | ( | EState * | estate, |
| ResultRelInfo * | relInfo | ||
| ) |
Definition at line 1209 of file execUtils.c.
References EState::es_query_cxt, ExecInitExtraTupleSlot(), fb(), MemoryContextSwitchTo(), RelationGetDescr, and table_slot_callbacks().
Referenced by AfterTriggerExecute(), AfterTriggerSaveEvent(), ExecARDeleteTriggers(), ExecARUpdateTriggers(), ExecBRDeleteTriggers(), ExecBRUpdateTriggers(), ExecIRDeleteTriggers(), and ExecIRUpdateTriggers().
| Bitmapset * ExecGetUpdatedCols | ( | ResultRelInfo * | relinfo, |
| EState * | estate | ||
| ) |
Definition at line 1387 of file execUtils.c.
References TupleConversionMap::attrMap, ExecGetRootToChildMap(), execute_attr_map_cols(), fb(), and GetResultRTEPermissionInfo().
Referenced by ExecConstraints(), ExecGetAllUpdatedCols(), ExecInitGenerated(), ExecPartitionCheckEmitError(), ExecWithCheckOptions(), get_tuple_desc(), index_unchanged_by_update(), and ReportNotNullViolationError().
| void ExecInitRangeTable | ( | EState * | estate, |
| List * | rangeTable, | ||
| List * | permInfos, | ||
| Bitmapset * | unpruned_relids | ||
| ) |
Definition at line 778 of file execUtils.c.
References EState::es_range_table, EState::es_range_table_size, EState::es_relations, EState::es_result_relations, EState::es_rowmarks, EState::es_rteperminfos, EState::es_unpruned_relids, fb(), list_length(), and palloc0().
Referenced by CopyFrom(), create_edata_for_relation(), create_estate_for_relation(), and InitPlan().
| void ExecInitResultRelation | ( | EState * | estate, |
| ResultRelInfo * | resultRelInfo, | ||
| Index | rti | ||
| ) |
Definition at line 885 of file execUtils.c.
References EState::es_instrument, EState::es_opened_result_relations, EState::es_range_table_size, EState::es_result_relations, ExecGetRangeTableRelation(), fb(), InitResultRelInfo(), lappend(), and palloc0().
Referenced by CopyFrom(), and ExecInitModifyTable().
Definition at line 747 of file execUtils.c.
References ereport, errcode(), errhint(), errmsg, ERROR, EXEC_FLAG_EXPLAIN_ONLY, EXEC_FLAG_WITH_NO_DATA, ExecGetRangeTableRelation(), fb(), RelationGetRelationName, and RelationIsScannable.
Referenced by ExecInitBitmapHeapScan(), ExecInitCustomScan(), ExecInitForeignScan(), ExecInitIndexOnlyScan(), ExecInitIndexScan(), ExecInitSampleScan(), ExecInitSeqScan(), ExecInitTidRangeScan(), ExecInitTidScan(), and postgresBeginDirectModify().
Definition at line 734 of file execUtils.c.
References EState::es_plannedstmt, list_member_int(), and PlannedStmt::resultRelations.
Definition at line 1180 of file execUtils.c.
References list_length().
Referenced by ExecTypeFromTLInternal().
Definition at line 941 of file execUtils.c.
References errposition(), EState::es_sourceText, fb(), and pg_mbstrlen_with_len().
Referenced by ExecInitFunc(), ExecInitSubscriptingRef(), and init_sexpr().
Definition at line 197 of file execUtils.c.
References DestroyPartitionDirectory(), EState::es_exprcontexts, EState::es_jit, EState::es_partition_directory, EState::es_query_cxt, fb(), FreeExprContext(), jit_release_context(), linitial, and MemoryContextDelete().
Referenced by afterTriggerInvokeEvents(), ATExecAddColumn(), ATRewriteTable(), check_default_partition_contents(), compute_expr_stats(), compute_index_stats(), CopyFrom(), EvalPlanQualEnd(), evaluate_expr(), ExecuteCallStmt(), ExecuteQuery(), ExecuteTruncateGuts(), ExplainExecuteQuery(), finish_edata(), freestate_cluster(), get_qual_for_range(), heapam_index_build_range_scan(), heapam_index_validate_scan(), IndexCheckExclusion(), make_build_data(), MergePartitionsMoveRows(), operator_predicate_proof(), plpgsql_inline_handler(), plpgsql_xact_cb(), SplitPartitionMoveRows(), standard_ExecutorEnd(), unique_key_recheck(), and validateDomainCheckConstraint().
| void FreeExprContext | ( | ExprContext * | econtext, |
| bool | isCommit | ||
| ) |
Definition at line 421 of file execUtils.c.
References ExprContext::ecxt_estate, ExprContext::ecxt_per_tuple_memory, EState::es_exprcontexts, fb(), list_delete_ptr(), MemoryContextDelete(), pfree(), and ShutdownExprContext().
Referenced by FreeExecutorState(), plpgsql_destroy_econtext(), and plpgsql_subxact_cb().
| Datum GetAttributeByName | ( | HeapTupleHeader | tuple, |
| const char * | attname, | ||
| bool * | isNull | ||
| ) |
Definition at line 1066 of file execUtils.c.
References attname, elog, ERROR, fb(), heap_getattr(), HeapTupleHeaderGetDatumLength(), HeapTupleHeaderGetTypeId(), HeapTupleHeaderGetTypMod(), i, InvalidAttrNumber, InvalidOid, ItemPointerSetInvalid(), lookup_rowtype_tupdesc(), namestrcmp(), TupleDescData::natts, ReleaseTupleDesc, and TupleDescAttr().
Referenced by c_overpaid(), and overpaid().
| Datum GetAttributeByNum | ( | HeapTupleHeader | tuple, |
| AttrNumber | attrno, | ||
| bool * | isNull | ||
| ) |
Definition at line 1129 of file execUtils.c.
References AttributeNumberIsValid, elog, ERROR, fb(), heap_getattr(), HeapTupleHeaderGetDatumLength(), HeapTupleHeaderGetTypeId(), HeapTupleHeaderGetTypMod(), InvalidOid, ItemPointerSetInvalid(), lookup_rowtype_tupdesc(), and ReleaseTupleDesc.
|
static |
Definition at line 1443 of file execUtils.c.
References EState::es_rteperminfos, exec_rt_fetch(), fb(), and getRTEPermissionInfo().
Referenced by ExecGetInsertedCols(), ExecGetResultRelCheckAsUser(), and ExecGetUpdatedCols().
| ExprContext * MakePerTupleExprContext | ( | EState * | estate | ) |
Definition at line 463 of file execUtils.c.
References CreateExprContext(), EState::es_per_tuple_exprcontext, and fb().
| void RegisterExprContextCallback | ( | ExprContext * | econtext, |
| ExprContextCallbackFunction | function, | ||
| Datum | arg | ||
| ) |
Definition at line 968 of file execUtils.c.
References arg, ExprContext::ecxt_callbacks, ExprContext::ecxt_per_query_memory, fb(), function, ExprContext_CB::function, and MemoryContextAlloc().
Referenced by AggRegisterCallback(), ExecMakeFunctionResultSet(), ExecPrepareTuplestoreResult(), fmgr_sql(), and init_MultiFuncCall().
| void ReScanExprContext | ( | ExprContext * | econtext | ) |
Definition at line 448 of file execUtils.c.
References ExprContext::ecxt_per_tuple_memory, MemoryContextReset(), and ShutdownExprContext().
Referenced by agg_refill_hash_table(), agg_retrieve_direct(), domain_check_input(), ExecEndAgg(), ExecReScan(), ExecReScanAgg(), and ValuesNext().
|
static |
Definition at line 1025 of file execUtils.c.
References ExprContext::ecxt_callbacks, ExprContext::ecxt_per_tuple_memory, fb(), ExprContext_CB::function, MemoryContextSwitchTo(), ExprContext_CB::next, and pfree().
Referenced by FreeExprContext(), and ReScanExprContext().
|
static |
Definition at line 635 of file execUtils.c.
References Assert, fb(), IsA, lfirst, list_head(), lnext(), TupleDescData::natts, TupleDescAttr(), Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by ExecConditionalAssignProjectionInfo().
| void UnregisterExprContextCallback | ( | ExprContext * | econtext, |
| ExprContextCallbackFunction | function, | ||
| Datum | arg | ||
| ) |
Definition at line 994 of file execUtils.c.
References arg, ExprContext::ecxt_callbacks, fb(), function, ExprContext_CB::next, and pfree().
Referenced by end_MultiFuncCall(), and fmgr_sql().
Definition at line 915 of file execUtils.c.
References Plan::allParam, bms_intersect(), bms_join(), PlanState::chgParam, fb(), and PlanState::plan.
Referenced by ExecReScan(), ExecReScanAppend(), ExecReScanBitmapAnd(), ExecReScanBitmapOr(), ExecReScanMergeAppend(), and ExecReScanSubqueryScan().