PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/sysattr.h"
#include "access/table.h"
#include "access/tableam.h"
#include "access/xact.h"
#include "catalog/namespace.h"
#include "catalog/partition.h"
#include "commands/matview.h"
#include "commands/trigger.h"
#include "executor/executor.h"
#include "executor/nodeSubplan.h"
#include "foreign/fdwapi.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "nodes/queryjumble.h"
#include "parser/parse_relation.h"
#include "rewrite/rewriteHandler.h"
#include "tcop/utility.h"
#include "utils/acl.h"
#include "utils/backend_status.h"
#include "utils/lsyscache.h"
#include "utils/partcache.h"
#include "utils/rls.h"
#include "utils/snapmgr.h"
Go to the source code of this file.
Macros | |
#define | EXEC_CHECK_QUERY_ID |
Functions | |
static void | InitPlan (QueryDesc *queryDesc, int eflags) |
static void | CheckValidRowMarkRel (Relation rel, RowMarkType markType) |
static void | ExecPostprocessPlan (EState *estate) |
static void | ExecEndPlan (PlanState *planstate, EState *estate) |
static void | ExecutePlan (EState *estate, PlanState *planstate, bool use_parallel_mode, CmdType operation, bool sendTuples, uint64 numberTuples, ScanDirection direction, DestReceiver *dest, bool execute_once) |
static bool | ExecCheckOneRelPerms (RTEPermissionInfo *perminfo) |
static bool | ExecCheckPermissionsModified (Oid relOid, Oid userid, Bitmapset *modifiedCols, AclMode requiredPerms) |
static void | ExecCheckXactReadOnly (PlannedStmt *plannedstmt) |
static void | EvalPlanQualStart (EPQState *epqstate, Plan *planTree) |
void | ExecutorStart (QueryDesc *queryDesc, int eflags) |
void | standard_ExecutorStart (QueryDesc *queryDesc, int eflags) |
void | ExecutorRun (QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once) |
void | standard_ExecutorRun (QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once) |
void | ExecutorFinish (QueryDesc *queryDesc) |
void | standard_ExecutorFinish (QueryDesc *queryDesc) |
void | ExecutorEnd (QueryDesc *queryDesc) |
void | standard_ExecutorEnd (QueryDesc *queryDesc) |
void | ExecutorRewind (QueryDesc *queryDesc) |
bool | ExecCheckPermissions (List *rangeTable, List *rteperminfos, bool ereport_on_violation) |
void | CheckValidResultRel (ResultRelInfo *resultRelInfo, CmdType operation, List *mergeActions) |
void | InitResultRelInfo (ResultRelInfo *resultRelInfo, Relation resultRelationDesc, Index resultRelationIndex, ResultRelInfo *partition_root_rri, int instrument_options) |
ResultRelInfo * | ExecGetTriggerResultRel (EState *estate, Oid relid, ResultRelInfo *rootRelInfo) |
List * | ExecGetAncestorResultRels (EState *estate, ResultRelInfo *resultRelInfo) |
void | ExecCloseResultRelations (EState *estate) |
void | ExecCloseRangeTableRelations (EState *estate) |
static const char * | ExecRelCheck (ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate) |
bool | ExecPartitionCheck (ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool emitError) |
void | ExecPartitionCheckEmitError (ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate) |
void | ExecConstraints (ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate) |
void | ExecWithCheckOptions (WCOKind kind, ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate) |
char * | ExecBuildSlotValueDescription (Oid reloid, TupleTableSlot *slot, TupleDesc tupdesc, Bitmapset *modifiedCols, int maxfieldlen) |
LockTupleMode | ExecUpdateLockMode (EState *estate, ResultRelInfo *relinfo) |
ExecRowMark * | ExecFindRowMark (EState *estate, Index rti, bool missing_ok) |
ExecAuxRowMark * | ExecBuildAuxRowMark (ExecRowMark *erm, List *targetlist) |
TupleTableSlot * | EvalPlanQual (EPQState *epqstate, Relation relation, Index rti, TupleTableSlot *inputslot) |
void | EvalPlanQualInit (EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations) |
void | EvalPlanQualSetPlan (EPQState *epqstate, Plan *subplan, List *auxrowmarks) |
TupleTableSlot * | EvalPlanQualSlot (EPQState *epqstate, Relation relation, Index rti) |
bool | EvalPlanQualFetchRowMark (EPQState *epqstate, Index rti, TupleTableSlot *slot) |
TupleTableSlot * | EvalPlanQualNext (EPQState *epqstate) |
void | EvalPlanQualBegin (EPQState *epqstate) |
void | EvalPlanQualEnd (EPQState *epqstate) |
Variables | |
ExecutorStart_hook_type | ExecutorStart_hook = NULL |
ExecutorRun_hook_type | ExecutorRun_hook = NULL |
ExecutorFinish_hook_type | ExecutorFinish_hook = NULL |
ExecutorEnd_hook_type | ExecutorEnd_hook = NULL |
ExecutorCheckPerms_hook_type | ExecutorCheckPerms_hook = NULL |
#define EXEC_CHECK_QUERY_ID |
Definition at line 80 of file execMain.c.
void CheckValidResultRel | ( | ResultRelInfo * | resultRelInfo, |
CmdType | operation, | ||
List * | mergeActions | ||
) |
Definition at line 1045 of file execMain.c.
References Assert, CheckCmdReplicaIdentity(), CMD_DELETE, CMD_INSERT, CMD_UPDATE, elog, ereport, errcode(), errmsg(), ERROR, error_view_not_updatable(), FdwRoutine::ExecForeignDelete, FdwRoutine::ExecForeignInsert, FdwRoutine::ExecForeignUpdate, FdwRoutine::IsForeignRelUpdatable, IsInplaceUpdateRelation(), MatViewIncrementalMaintenanceIsEnabled(), RelationData::rd_rel, RelationGetRelationName, ResultRelInfo::ri_FdwRoutine, ResultRelInfo::ri_needLockTagTuple, ResultRelInfo::ri_RelationDesc, and view_has_instead_trigger().
Referenced by CopyFrom(), ExecFindPartition(), ExecInitModifyTable(), and ExecInitPartitionInfo().
|
static |
Definition at line 1157 of file execMain.c.
References ereport, errcode(), errmsg(), ERROR, GetFdwRoutineForRelation(), RelationData::rd_rel, FdwRoutine::RefetchForeignRow, RelationGetRelationName, and ROW_MARK_REFERENCE.
Referenced by InitPlan().
TupleTableSlot* EvalPlanQual | ( | EPQState * | epqstate, |
Relation | relation, | ||
Index | rti, | ||
TupleTableSlot * | inputslot | ||
) |
Definition at line 2495 of file execMain.c.
References Assert, EvalPlanQualBegin(), EvalPlanQualNext(), EvalPlanQualSlot(), ExecClearTuple(), ExecCopySlot(), ExecMaterializeSlot(), EPQState::relsubs_blocked, EPQState::relsubs_done, and TupIsNull.
Referenced by ExecDelete(), ExecMergeMatched(), ExecUpdate(), and GetTupleForTrigger().
void EvalPlanQualBegin | ( | EPQState * | epqstate | ) |
Definition at line 2776 of file execMain.c.
References bms_add_member(), PlanState::chgParam, EPQState::epqParam, EState::es_param_exec_vals, EState::es_plannedstmt, EState::es_range_table_size, EvalPlanQualStart(), ExecSetParamPlanMulti(), Plan::extParam, GetPerTupleExprContext, i, ParamExecData::isnull, list_length(), NIL, PlannedStmt::paramExecTypes, EPQState::parentestate, PlanState::plan, EPQState::plan, EPQState::recheckestate, EPQState::recheckplanstate, EPQState::relsubs_blocked, EPQState::relsubs_done, and ParamExecData::value.
Referenced by EvalPlanQual(), ExecDelete(), and ExecLockRows().
void EvalPlanQualEnd | ( | EPQState * | epqstate | ) |
Definition at line 3007 of file execMain.c.
References EState::es_query_cxt, EState::es_range_table_size, EState::es_subplanstates, EState::es_tupleTable, ExecCloseResultRelations(), ExecEndNode(), ExecResetTupleTable(), FreeExecutorState(), lfirst, MemoryContextSwitchTo(), NIL, EPQState::origslot, EPQState::parentestate, EPQState::recheckestate, EPQState::recheckplanstate, EPQState::relsubs_blocked, EPQState::relsubs_done, EPQState::relsubs_rowmark, EPQState::relsubs_slot, and EPQState::tuple_table.
Referenced by apply_handle_delete_internal(), apply_handle_tuple_routing(), apply_handle_update_internal(), EvalPlanQualSetPlan(), ExecEndLockRows(), ExecEndModifyTable(), and ExecLockRows().
bool EvalPlanQualFetchRowMark | ( | EPQState * | epqstate, |
Index | rti, | ||
TupleTableSlot * | slot | ||
) |
Definition at line 2651 of file execMain.c.
References Assert, ExecAuxRowMark::ctidAttNo, DatumGetObjectId(), DatumGetPointer(), elog, ereport, errcode(), errmsg(), ERROR, ExecGetJunkAttribute(), ExecStoreHeapTupleDatum(), GetFdwRoutineForRelation(), ExecRowMark::markType, OidIsValid, EPQState::origslot, ExecRowMark::prti, RelationData::rd_rel, EPQState::recheckestate, FdwRoutine::RefetchForeignRow, ExecRowMark::relation, RelationGetRelationName, ExecRowMark::relid, EPQState::relsubs_rowmark, ROW_MARK_COPY, ROW_MARK_REFERENCE, ExecAuxRowMark::rowmark, RowMarkRequiresRowShareLock, ExecRowMark::rti, SnapshotAny, table_tuple_fetch_row_version(), ExecAuxRowMark::toidAttNo, TupIsNull, and ExecAuxRowMark::wholeAttNo.
Referenced by ExecScanFetch().
void EvalPlanQualInit | ( | EPQState * | epqstate, |
EState * | parentestate, | ||
Plan * | subplan, | ||
List * | auxrowmarks, | ||
int | epqParam, | ||
List * | resultRelations | ||
) |
Definition at line 2564 of file execMain.c.
References EPQState::arowMarks, EPQState::epqParam, EState::es_range_table_size, NIL, EPQState::origslot, palloc0(), EPQState::parentestate, EPQState::plan, EPQState::recheckestate, EPQState::recheckplanstate, EPQState::relsubs_blocked, EPQState::relsubs_done, EPQState::relsubs_rowmark, EPQState::relsubs_slot, EPQState::resultRelations, and EPQState::tuple_table.
Referenced by apply_handle_delete_internal(), apply_handle_tuple_routing(), apply_handle_update_internal(), ExecInitLockRows(), and ExecInitModifyTable().
TupleTableSlot* EvalPlanQualNext | ( | EPQState * | epqstate | ) |
Definition at line 2760 of file execMain.c.
References EState::es_query_cxt, ExecProcNode(), MemoryContextSwitchTo(), EPQState::recheckestate, and EPQState::recheckplanstate.
Referenced by EvalPlanQual(), and ExecLockRows().
Definition at line 2606 of file execMain.c.
References EPQState::arowMarks, EvalPlanQualEnd(), and EPQState::plan.
Referenced by ExecInitModifyTable().
TupleTableSlot* EvalPlanQualSlot | ( | EPQState * | epqstate, |
Relation | relation, | ||
Index | rti | ||
) |
Definition at line 2623 of file execMain.c.
References Assert, EState::es_query_cxt, MemoryContextSwitchTo(), EPQState::parentestate, EPQState::relsubs_slot, table_slot_create(), and EPQState::tuple_table.
Referenced by EvalPlanQual(), ExecDelete(), ExecLockRows(), ExecMergeMatched(), and ExecUpdate().
Definition at line 2843 of file execMain.c.
References EPQState::arowMarks, Assert, CreateExecutorState(), EState::es_crosscheck_snapshot, EState::es_direction, EState::es_epq_active, EState::es_instrument, EState::es_junkFilter, EState::es_output_cid, EState::es_param_exec_vals, EState::es_param_list_info, EState::es_plannedstmt, 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_subplanstates, EState::es_top_eflags, ExecInitNode(), ExecSetParamPlanMulti(), Plan::extParam, ForwardScanDirection, GetPerTupleExprContext, i, ParamExecData::isnull, lappend(), lfirst, lfirst_int, list_length(), MemoryContextSwitchTo(), NIL, palloc0(), palloc0_array, palloc_array, PlannedStmt::paramExecTypes, EPQState::parentestate, EPQState::recheckestate, EPQState::recheckplanstate, EPQState::relsubs_blocked, EPQState::relsubs_done, EPQState::relsubs_rowmark, EPQState::resultRelations, ExecAuxRowMark::rowmark, ExecRowMark::rti, PlannedStmt::subplans, and ParamExecData::value.
Referenced by EvalPlanQualBegin().
ExecAuxRowMark* ExecBuildAuxRowMark | ( | ExecRowMark * | erm, |
List * | targetlist | ||
) |
Definition at line 2425 of file execMain.c.
References AttributeNumberIsValid, ExecAuxRowMark::ctidAttNo, elog, ERROR, ExecFindJunkAttributeInTlist(), ExecRowMark::markType, palloc0(), ExecRowMark::prti, ROW_MARK_COPY, ExecAuxRowMark::rowmark, ExecRowMark::rowmarkId, ExecRowMark::rti, snprintf, ExecAuxRowMark::toidAttNo, and ExecAuxRowMark::wholeAttNo.
Referenced by ExecInitLockRows(), and ExecInitModifyTable().
char* ExecBuildSlotValueDescription | ( | Oid | reloid, |
TupleTableSlot * | slot, | ||
TupleDesc | tupdesc, | ||
Bitmapset * | modifiedCols, | ||
int | maxfieldlen | ||
) |
Definition at line 2239 of file execMain.c.
References ACL_SELECT, ACLCHECK_OK, appendBinaryStringInfo(), appendStringInfoChar(), appendStringInfoString(), bms_is_member(), buf, check_enable_rls(), StringInfoData::data, FirstLowInvalidHeapAttributeNumber, getTypeOutputInfo(), GetUserId(), i, initStringInfo(), InvalidOid, NameStr, TupleDescData::natts, OidOutputFunctionCall(), pg_attribute_aclcheck(), pg_class_aclcheck(), pg_mbcliplen(), RLS_ENABLED, slot_getallattrs(), TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, TupleDescAttr, and val.
Referenced by build_tuple_value_details(), ExecConstraints(), ExecPartitionCheckEmitError(), and ExecWithCheckOptions().
|
static |
Definition at line 662 of file execMain.c.
References ACL_INSERT, ACL_SELECT, ACL_UPDATE, ACLCHECK_OK, ACLMASK_ALL, ACLMASK_ANY, Assert, bms_is_empty, bms_next_member(), RTEPermissionInfo::checkAsUser, ExecCheckPermissionsModified(), FirstLowInvalidHeapAttributeNumber, GetUserId(), RTEPermissionInfo::insertedCols, InvalidAttrNumber, OidIsValid, pg_attribute_aclcheck(), pg_attribute_aclcheck_all(), pg_class_aclmask(), RTEPermissionInfo::relid, RTEPermissionInfo::requiredPerms, RTEPermissionInfo::selectedCols, and RTEPermissionInfo::updatedCols.
Referenced by ExecCheckPermissions().
Definition at line 598 of file execMain.c.
References aclcheck_error(), ACLCHECK_NO_PRIV, Assert, bms_add_member(), bms_is_member(), bms_num_members(), ExecCheckOneRelPerms(), ExecutorCheckPerms_hook, get_rel_name(), get_rel_relkind(), get_relkind_objtype(), getRTEPermissionInfo(), lfirst_node, list_length(), OidIsValid, RTEPermissionInfo::relid, RTE_RELATION, RTE_SUBQUERY, and RangeTblEntry::rtekind.
Referenced by DoCopy(), InitPlan(), and RI_Initial_Check().
|
static |
Definition at line 771 of file execMain.c.
References ACLCHECK_OK, ACLMASK_ANY, bms_is_empty, bms_next_member(), elog, ERROR, FirstLowInvalidHeapAttributeNumber, InvalidAttrNumber, pg_attribute_aclcheck(), and pg_attribute_aclcheck_all().
Referenced by ExecCheckOneRelPerms().
|
static |
Definition at line 818 of file execMain.c.
References ACL_SELECT, CMD_SELECT, PlannedStmt::commandType, CreateCommandName(), get_rel_namespace(), PlannedStmt::hasModifyingCTE, isTempNamespace(), lfirst_node, PlannedStmt::permInfos, PreventCommandIfParallelMode(), PreventCommandIfReadOnly(), RTEPermissionInfo::relid, and RTEPermissionInfo::requiredPerms.
Referenced by standard_ExecutorStart().
void ExecCloseRangeTableRelations | ( | EState * | estate | ) |
Definition at line 1602 of file execMain.c.
References EState::es_range_table_size, EState::es_relations, i, NoLock, and table_close().
Referenced by CopyFrom(), and ExecEndPlan().
void ExecCloseResultRelations | ( | EState * | estate | ) |
Definition at line 1542 of file execMain.c.
References Assert, EState::es_opened_result_relations, EState::es_trig_target_relations, ExecCloseIndices(), lfirst, NoLock, ResultRelInfo::ri_ancestorResultRels, ResultRelInfo::ri_NumIndices, ResultRelInfo::ri_RangeTableIndex, ResultRelInfo::ri_RelationDesc, and table_close().
Referenced by afterTriggerInvokeEvents(), CopyFrom(), EvalPlanQualEnd(), and ExecEndPlan().
void ExecConstraints | ( | ResultRelInfo * | resultRelInfo, |
TupleTableSlot * | slot, | ||
EState * | estate | ||
) |
Definition at line 1941 of file execMain.c.
References Assert, bms_union(), build_attrmap_by_name_if_req(), TupleDescData::constr, ereport, errcode(), errdetail(), errmsg(), ERROR, errtablecol(), errtableconstraint(), ExecBuildSlotValueDescription(), ExecGetInsertedCols(), ExecGetUpdatedCols(), ExecRelCheck(), execute_attr_map_slot(), TupleConstr::has_not_null, MakeTupleTableSlot(), NameStr, TupleDescData::natts, RelationData::rd_rel, RelationGetDescr, RelationGetRelationName, RelationGetRelid, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_RootResultRelInfo, slot_attisnull(), TTSOpsVirtual, and TupleDescAttr.
Referenced by CopyFrom(), ExecInsert(), ExecSimpleRelationInsert(), ExecSimpleRelationUpdate(), and ExecUpdateAct().
Definition at line 1503 of file execMain.c.
References EState::es_subplanstates, EState::es_tupleTable, ExecCloseRangeTableRelations(), ExecCloseResultRelations(), ExecEndNode(), ExecResetTupleTable(), and lfirst.
Referenced by standard_ExecutorEnd().
ExecRowMark* ExecFindRowMark | ( | EState * | estate, |
Index | rti, | ||
bool | missing_ok | ||
) |
Definition at line 2402 of file execMain.c.
References elog, ERROR, and EState::es_rowmarks.
Referenced by ExecInitLockRows(), and ExecInitModifyTable().
List* ExecGetAncestorResultRels | ( | EState * | estate, |
ResultRelInfo * | resultRelInfo | ||
) |
Definition at line 1397 of file execMain.c.
References Assert, elog, ERROR, EState::es_instrument, get_partition_ancestors(), InitResultRelInfo(), lappend(), lfirst_oid, makeNode, NIL, NoLock, RelationData::rd_rel, RelationGetRelid, ResultRelInfo::ri_ancestorResultRels, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_RootResultRelInfo, and table_open().
Referenced by ExecCrossPartitionUpdateForeignKey().
ResultRelInfo* ExecGetTriggerResultRel | ( | EState * | estate, |
Oid | relid, | ||
ResultRelInfo * | rootRelInfo | ||
) |
Definition at line 1321 of file execMain.c.
References EState::es_instrument, EState::es_opened_result_relations, EState::es_query_cxt, EState::es_trig_target_relations, EState::es_tuple_routing_result_relations, InitResultRelInfo(), lappend(), lfirst, makeNode, MemoryContextSwitchTo(), NoLock, RelationGetRelid, ResultRelInfo::ri_RelationDesc, and table_open().
Referenced by afterTriggerInvokeEvents().
bool ExecPartitionCheck | ( | ResultRelInfo * | resultRelInfo, |
TupleTableSlot * | slot, | ||
EState * | estate, | ||
bool | emitError | ||
) |
Definition at line 1817 of file execMain.c.
References ExprContext::ecxt_scantuple, EState::es_query_cxt, ExecCheck(), ExecPartitionCheckEmitError(), ExecPrepareCheck(), GetPerTupleExprContext, MemoryContextSwitchTo(), RelationGetPartitionQual(), ResultRelInfo::ri_PartitionCheckExpr, ResultRelInfo::ri_RelationDesc, and success.
Referenced by apply_handle_tuple_routing(), CopyFrom(), ExecBRInsertTriggers(), ExecFindPartition(), ExecInsert(), ExecSimpleRelationInsert(), ExecSimpleRelationUpdate(), and ExecUpdateAct().
void ExecPartitionCheckEmitError | ( | ResultRelInfo * | resultRelInfo, |
TupleTableSlot * | slot, | ||
EState * | estate | ||
) |
Definition at line 1870 of file execMain.c.
References bms_union(), build_attrmap_by_name_if_req(), ereport, errcode(), errdetail(), errmsg(), ERROR, errtable(), ExecBuildSlotValueDescription(), ExecGetInsertedCols(), ExecGetUpdatedCols(), execute_attr_map_slot(), MakeTupleTableSlot(), RelationGetDescr, RelationGetRelationName, RelationGetRelid, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_RootResultRelInfo, and TTSOpsVirtual.
Referenced by ExecCrossPartitionUpdate(), and ExecPartitionCheck().
|
static |
Definition at line 1457 of file execMain.c.
References EState::es_auxmodifytables, EState::es_direction, ExecProcNode(), ForwardScanDirection, lfirst, ps, ResetPerTupleExprContext, and TupIsNull.
Referenced by standard_ExecutorFinish().
|
static |
Definition at line 1742 of file execMain.c.
References ConstrCheck::ccname, TupleConstr::check, TupleDescData::constr, ExprContext::ecxt_scantuple, elog, ERROR, EState::es_query_cxt, ExecCheck(), ExecPrepareExpr(), GetPerTupleExprContext, i, MemoryContextSwitchTo(), TupleConstr::num_check, palloc(), RelationData::rd_att, RelationData::rd_rel, RelationGetRelationName, ResultRelInfo::ri_ConstraintExprs, ResultRelInfo::ri_RelationDesc, and stringToNode().
Referenced by ExecConstraints().
LockTupleMode ExecUpdateLockMode | ( | EState * | estate, |
ResultRelInfo * | relinfo | ||
) |
Definition at line 2376 of file execMain.c.
References bms_overlap(), ExecGetAllUpdatedCols(), INDEX_ATTR_BITMAP_KEY, LockTupleExclusive, LockTupleNoKeyExclusive, RelationGetIndexAttrBitmap(), and ResultRelInfo::ri_RelationDesc.
Referenced by ExecBRUpdateTriggers(), ExecMergeMatched(), and ExecOnConflictUpdate().
|
static |
Definition at line 1626 of file execMain.c.
References CMD_SELECT, generate_unaccent_rules::dest, EnterParallelMode(), EState::es_direction, EState::es_junkFilter, EState::es_processed, EState::es_top_eflags, EState::es_use_parallel_mode, EXEC_FLAG_BACKWARD, ExecFilterJunk(), ExecProcNode(), ExecShutdownNode(), ExitParallelMode(), ResetPerTupleExprContext, and TupIsNull.
Referenced by standard_ExecutorRun().
void ExecutorEnd | ( | QueryDesc * | queryDesc | ) |
Definition at line 483 of file execMain.c.
References EXEC_CHECK_QUERY_ID, ExecutorEnd_hook, and standard_ExecutorEnd().
Referenced by _SPI_pquery(), EndCopyTo(), ExecCreateTableAs(), execute_sql_string(), ExplainOnePlan(), ParallelQueryMain(), PersistHoldablePortal(), PortalCleanup(), postquel_end(), ProcessQuery(), and refresh_matview_datafill().
void ExecutorFinish | ( | QueryDesc * | queryDesc | ) |
Definition at line 420 of file execMain.c.
References EXEC_CHECK_QUERY_ID, ExecutorFinish_hook, and standard_ExecutorFinish().
Referenced by _SPI_pquery(), EndCopyTo(), ExecCreateTableAs(), execute_sql_string(), ExplainOnePlan(), ParallelQueryMain(), PersistHoldablePortal(), PortalCleanup(), postquel_end(), ProcessQuery(), and refresh_matview_datafill().
void ExecutorRewind | ( | QueryDesc * | queryDesc | ) |
Definition at line 552 of file execMain.c.
References Assert, CMD_SELECT, EState::es_query_cxt, QueryDesc::estate, ExecReScan(), MemoryContextSwitchTo(), QueryDesc::operation, and QueryDesc::planstate.
Referenced by DoPortalRewind(), and PersistHoldablePortal().
void ExecutorRun | ( | QueryDesc * | queryDesc, |
ScanDirection | direction, | ||
uint64 | count, | ||
bool | execute_once | ||
) |
Definition at line 307 of file execMain.c.
References EXEC_CHECK_QUERY_ID, ExecutorRun_hook, and standard_ExecutorRun().
Referenced by _SPI_pquery(), DoCopyTo(), ExecCreateTableAs(), execute_sql_string(), ExplainOnePlan(), ParallelQueryMain(), PersistHoldablePortal(), PortalRunSelect(), postquel_getnext(), ProcessQuery(), and refresh_matview_datafill().
void ExecutorStart | ( | QueryDesc * | queryDesc, |
int | eflags | ||
) |
Definition at line 132 of file execMain.c.
References ExecutorStart_hook, pgstat_report_query_id(), QueryDesc::plannedstmt, PlannedStmt::queryId, and standard_ExecutorStart().
Referenced by _SPI_pquery(), BeginCopyTo(), ExecCreateTableAs(), execute_sql_string(), ExplainOnePlan(), ParallelQueryMain(), PortalStart(), postquel_start(), ProcessQuery(), and refresh_matview_datafill().
void ExecWithCheckOptions | ( | WCOKind | kind, |
ResultRelInfo * | resultRelInfo, | ||
TupleTableSlot * | slot, | ||
EState * | estate | ||
) |
Definition at line 2076 of file execMain.c.
References bms_union(), build_attrmap_by_name_if_req(), ExprContext::ecxt_scantuple, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, ExecBuildSlotValueDescription(), ExecGetInsertedCols(), ExecGetUpdatedCols(), ExecQual(), execute_attr_map_slot(), forboth, GetPerTupleExprContext, WithCheckOption::kind, lfirst, MakeTupleTableSlot(), WithCheckOption::polname, RelationGetDescr, RelationGetRelid, WithCheckOption::relname, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_RootResultRelInfo, ResultRelInfo::ri_WithCheckOptionExprs, ResultRelInfo::ri_WithCheckOptions, TTSOpsVirtual, WCO_RLS_CONFLICT_CHECK, WCO_RLS_INSERT_CHECK, WCO_RLS_MERGE_DELETE_CHECK, WCO_RLS_MERGE_UPDATE_CHECK, WCO_RLS_UPDATE_CHECK, and WCO_VIEW_CHECK.
Referenced by ExecBatchInsert(), ExecInsert(), ExecMergeMatched(), ExecOnConflictUpdate(), ExecUpdateAct(), and ExecUpdateEpilogue().
|
static |
Definition at line 852 of file execMain.c.
References Assert, bms_is_member(), CheckValidRowMarkRel(), CMD_SELECT, ExecRowMark::curCtid, elog, ExecRowMark::ermActive, ExecRowMark::ermExtra, ERROR, EState::es_epq_active, EState::es_junkFilter, EState::es_plannedstmt, EState::es_range_table_size, EState::es_rowmarks, EState::es_subplanstates, EState::es_tupleTable, QueryDesc::estate, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, EXEC_FLAG_REWIND, exec_rt_fetch(), ExecCheckPermissions(), ExecGetRangeTableRelation(), ExecGetResultType(), ExecInitExtraTupleSlot(), ExecInitJunkFilter(), ExecInitNode(), ExecInitRangeTable(), i, PlanRowMark::isParent, ItemPointerSetInvalid(), j, lappend(), lfirst, ExecRowMark::markType, PlanRowMark::markType, NIL, QueryDesc::operation, palloc(), palloc0(), PlannedStmt::permInfos, PlanState::plan, plan, QueryDesc::plannedstmt, QueryDesc::planstate, PlannedStmt::planTree, ExecRowMark::prti, PlanRowMark::prti, ExecRowMark::relation, ExecRowMark::relid, RangeTblEntry::relid, PlannedStmt::rewindPlanIDs, ROW_MARK_COPY, ROW_MARK_EXCLUSIVE, ROW_MARK_KEYSHARE, ROW_MARK_NOKEYEXCLUSIVE, ROW_MARK_REFERENCE, ROW_MARK_SHARE, ExecRowMark::rowmarkId, PlanRowMark::rowmarkId, PlannedStmt::rowMarks, PlannedStmt::rtable, ExecRowMark::rti, PlanRowMark::rti, ExecRowMark::strength, PlanRowMark::strength, PlannedStmt::subplans, Plan::targetlist, TTSOpsVirtual, QueryDesc::tupDesc, ExecRowMark::waitPolicy, and PlanRowMark::waitPolicy.
Referenced by standard_ExecutorStart().
void InitResultRelInfo | ( | ResultRelInfo * | resultRelInfo, |
Relation | resultRelationDesc, | ||
Index | resultRelationIndex, | ||
ResultRelInfo * | partition_root_rri, | ||
int | instrument_options | ||
) |
Definition at line 1222 of file execMain.c.
References CopyTriggerDesc(), GetFdwRoutineForRelation(), InstrAlloc(), IsInplaceUpdateRelation(), MemSet, MERGE_WHEN_MATCHED, MERGE_WHEN_NOT_MATCHED_BY_SOURCE, MERGE_WHEN_NOT_MATCHED_BY_TARGET, NIL, TriggerDesc::numtriggers, palloc0(), RelationData::rd_rel, ResultRelInfo::ri_ChildToRootMap, ResultRelInfo::ri_ChildToRootMapValid, ResultRelInfo::ri_ConstraintExprs, ResultRelInfo::ri_CopyMultiInsertBuffer, ResultRelInfo::ri_extraUpdatedCols, ResultRelInfo::ri_FdwRoutine, ResultRelInfo::ri_FdwState, ResultRelInfo::ri_GeneratedExprsI, ResultRelInfo::ri_GeneratedExprsU, ResultRelInfo::ri_IndexRelationDescs, ResultRelInfo::ri_IndexRelationInfo, ResultRelInfo::ri_MergeActions, ResultRelInfo::ri_MergeJoinCondition, ResultRelInfo::ri_needLockTagTuple, ResultRelInfo::ri_newTupleSlot, ResultRelInfo::ri_NumIndices, ResultRelInfo::ri_oldTupleSlot, ResultRelInfo::ri_onConflict, ResultRelInfo::ri_onConflictArbiterIndexes, ResultRelInfo::ri_PartitionTupleSlot, ResultRelInfo::ri_projectNew, ResultRelInfo::ri_projectNewInfoValid, ResultRelInfo::ri_projectReturning, ResultRelInfo::ri_RangeTableIndex, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_ReturningSlot, ResultRelInfo::ri_RootResultRelInfo, ResultRelInfo::ri_RootToChildMap, ResultRelInfo::ri_RootToChildMapValid, ResultRelInfo::ri_RowIdAttNo, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, ResultRelInfo::ri_TrigNewSlot, ResultRelInfo::ri_TrigOldSlot, ResultRelInfo::ri_TrigWhenExprs, ResultRelInfo::ri_usesFdwDirectModify, RelationData::trigdesc, and ResultRelInfo::type.
Referenced by create_edata_for_relation(), ExecGetAncestorResultRels(), ExecGetTriggerResultRel(), ExecInitPartitionDispatchInfo(), ExecInitPartitionInfo(), ExecInitResultRelation(), and ExecuteTruncateGuts().
void standard_ExecutorEnd | ( | QueryDesc * | queryDesc | ) |
Definition at line 495 of file execMain.c.
References Assert, EState::es_crosscheck_snapshot, EState::es_finished, EState::es_query_cxt, EState::es_snapshot, EState::es_top_eflags, QueryDesc::estate, EXEC_FLAG_EXPLAIN_ONLY, ExecEndPlan(), FreeExecutorState(), MemoryContextSwitchTo(), QueryDesc::planstate, QueryDesc::totaltime, QueryDesc::tupDesc, and UnregisterSnapshot().
Referenced by ExecutorEnd(), explain_ExecutorEnd(), and pgss_ExecutorEnd().
void standard_ExecutorFinish | ( | QueryDesc * | queryDesc | ) |
Definition at line 432 of file execMain.c.
References AfterTriggerEndQuery(), Assert, EState::es_finished, EState::es_query_cxt, EState::es_top_eflags, QueryDesc::estate, EXEC_FLAG_EXPLAIN_ONLY, EXEC_FLAG_SKIP_TRIGGERS, ExecPostprocessPlan(), InstrStartNode(), InstrStopNode(), MemoryContextSwitchTo(), and QueryDesc::totaltime.
Referenced by ExecutorFinish(), explain_ExecutorFinish(), and pgss_ExecutorFinish().
void standard_ExecutorRun | ( | QueryDesc * | queryDesc, |
ScanDirection | direction, | ||
uint64 | count, | ||
bool | execute_once | ||
) |
Definition at line 321 of file execMain.c.
References QueryDesc::already_executed, Assert, CMD_SELECT, generate_unaccent_rules::dest, QueryDesc::dest, elog, ERROR, EState::es_processed, EState::es_query_cxt, EState::es_snapshot, EState::es_top_eflags, EState::es_total_processed, QueryDesc::estate, EXEC_FLAG_EXPLAIN_ONLY, ExecutePlan(), GetActiveSnapshot(), PlannedStmt::hasReturning, InstrStartNode(), InstrStopNode(), MemoryContextSwitchTo(), QueryDesc::operation, PlannedStmt::parallelModeNeeded, QueryDesc::plannedstmt, QueryDesc::planstate, ScanDirectionIsNoMovement, QueryDesc::totaltime, and QueryDesc::tupDesc.
Referenced by ExecutorRun(), explain_ExecutorRun(), and pgss_ExecutorRun().
void standard_ExecutorStart | ( | QueryDesc * | queryDesc, |
int | eflags | ||
) |
Definition at line 151 of file execMain.c.
References AfterTriggerBeginQuery(), Assert, CMD_DELETE, CMD_INSERT, CMD_MERGE, CMD_SELECT, CMD_UPDATE, CreateExecutorState(), QueryDesc::crosscheck_snapshot, elog, ERROR, EState::es_crosscheck_snapshot, EState::es_instrument, EState::es_jit_flags, EState::es_output_cid, EState::es_param_exec_vals, EState::es_param_list_info, EState::es_query_cxt, EState::es_queryEnv, EState::es_snapshot, EState::es_sourceText, EState::es_top_eflags, QueryDesc::estate, EXEC_FLAG_EXPLAIN_ONLY, EXEC_FLAG_SKIP_TRIGGERS, ExecCheckXactReadOnly(), GetActiveSnapshot(), GetCurrentCommandId(), PlannedStmt::hasModifyingCTE, InitPlan(), QueryDesc::instrument_options, IsInParallelMode(), PlannedStmt::jitFlags, list_length(), MemoryContextSwitchTo(), NIL, QueryDesc::operation, palloc0(), PlannedStmt::paramExecTypes, QueryDesc::params, QueryDesc::plannedstmt, QueryDesc::queryEnv, RegisterSnapshot(), PlannedStmt::rowMarks, QueryDesc::snapshot, QueryDesc::sourceText, and XactReadOnly.
Referenced by ExecutorStart(), explain_ExecutorStart(), and pgss_ExecutorStart().
ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook = NULL |
Definition at line 72 of file execMain.c.
Referenced by _PG_init(), and ExecCheckPermissions().
ExecutorEnd_hook_type ExecutorEnd_hook = NULL |
Definition at line 69 of file execMain.c.
Referenced by _PG_init(), and ExecutorEnd().
ExecutorFinish_hook_type ExecutorFinish_hook = NULL |
Definition at line 68 of file execMain.c.
Referenced by _PG_init(), and ExecutorFinish().
ExecutorRun_hook_type ExecutorRun_hook = NULL |
Definition at line 67 of file execMain.c.
Referenced by _PG_init(), and ExecutorRun().
ExecutorStart_hook_type ExecutorStart_hook = NULL |
Definition at line 66 of file execMain.c.
Referenced by _PG_init(), and ExecutorStart().