PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/tableam.h"
#include "access/transam.h"
#include "access/xact.h"
#include "catalog/namespace.h"
#include "catalog/pg_publication.h"
#include "commands/matview.h"
#include "commands/trigger.h"
#include "executor/execdebug.h"
#include "executor/nodeSubplan.h"
#include "foreign/fdwapi.h"
#include "jit/jit.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "parser/parsetree.h"
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "tcop/utility.h"
#include "utils/acl.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/partcache.h"
#include "utils/rls.h"
#include "utils/ruleutils.h"
#include "utils/snapmgr.h"
Go to the source code of this file.
Macros | |
#define | GetInsertedColumns(relinfo, estate) (exec_rt_fetch((relinfo)->ri_RangeTableIndex, estate)->insertedCols) |
#define | GetUpdatedColumns(relinfo, estate) (exec_rt_fetch((relinfo)->ri_RangeTableIndex, estate)->updatedCols) |
#define | GetAllUpdatedColumns(relinfo, estate) |
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 | ExecCheckRTEPerms (RangeTblEntry *rte) |
static bool | ExecCheckRTEPermsModified (Oid relOid, Oid userid, Bitmapset *modifiedCols, AclMode requiredPerms) |
static void | ExecCheckXactReadOnly (PlannedStmt *plannedstmt) |
static char * | ExecBuildSlotValueDescription (Oid reloid, TupleTableSlot *slot, TupleDesc tupdesc, Bitmapset *modifiedCols, int maxfieldlen) |
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 | ExecCheckRTPerms (List *rangeTable, bool ereport_on_violation) |
void | CheckValidResultRel (ResultRelInfo *resultRelInfo, CmdType operation) |
void | InitResultRelInfo (ResultRelInfo *resultRelInfo, Relation resultRelationDesc, Index resultRelationIndex, Relation partition_root, int instrument_options) |
ResultRelInfo * | ExecGetTriggerResultRel (EState *estate, Oid relid) |
void | ExecCleanUpTriggerState (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) |
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) |
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 GetAllUpdatedColumns | ( | relinfo, | |
estate | |||
) |
Definition at line 113 of file execMain.c.
Referenced by ExecUpdateLockMode().
#define GetInsertedColumns | ( | relinfo, | |
estate | |||
) | (exec_rt_fetch((relinfo)->ri_RangeTableIndex, estate)->insertedCols) |
Definition at line 109 of file execMain.c.
Referenced by ExecConstraints(), ExecPartitionCheckEmitError(), and ExecWithCheckOptions().
#define GetUpdatedColumns | ( | relinfo, | |
estate | |||
) | (exec_rt_fetch((relinfo)->ri_RangeTableIndex, estate)->updatedCols) |
Definition at line 111 of file execMain.c.
Referenced by ExecConstraints(), ExecPartitionCheckEmitError(), and ExecWithCheckOptions().
void CheckValidResultRel | ( | ResultRelInfo * | resultRelInfo, |
CmdType | operation | ||
) |
Definition at line 1076 of file execMain.c.
References CheckCmdReplicaIdentity(), CMD_DELETE, CMD_INSERT, CMD_UPDATE, elog, ereport, errcode(), errhint(), errmsg(), ERROR, FdwRoutine::ExecForeignDelete, FdwRoutine::ExecForeignInsert, FdwRoutine::ExecForeignUpdate, FdwRoutine::IsForeignRelUpdatable, MatViewIncrementalMaintenanceIsEnabled(), RelationData::rd_rel, RelationGetRelationName, ResultRelInfo::ri_FdwRoutine, ResultRelInfo::ri_RelationDesc, TriggerDesc::trig_delete_instead_row, TriggerDesc::trig_insert_instead_row, TriggerDesc::trig_update_instead_row, and RelationData::trigdesc.
Referenced by CopyFrom(), ExecFindPartition(), ExecInitModifyTable(), and ExecInitPartitionInfo().
|
static |
Definition at line 1212 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 2430 of file execMain.c.
References Assert, EvalPlanQualBegin(), EvalPlanQualNext(), EvalPlanQualSlot(), ExecClearTuple(), ExecCopySlot(), ExecMaterializeSlot(), and TupIsNull.
Referenced by ExecDelete(), ExecUpdate(), and GetTupleForTrigger().
void EvalPlanQualBegin | ( | EPQState * | epqstate | ) |
Definition at line 2692 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(), MemSet, NIL, PlannedStmt::paramExecTypes, EPQState::parentestate, PlanState::plan, EPQState::plan, EPQState::recheckestate, EPQState::recheckplanstate, EPQState::relsubs_done, and ParamExecData::value.
Referenced by EvalPlanQual(), ExecDelete(), and ExecLockRows().
void EvalPlanQualEnd | ( | EPQState * | epqstate | ) |
Definition at line 2944 of file execMain.c.
References EState::es_query_cxt, EState::es_range_table_size, EState::es_subplanstates, EState::es_tupleTable, ExecCleanUpTriggerState(), ExecEndNode(), ExecResetTupleTable(), FreeExecutorState(), lfirst, MemoryContextSwitchTo(), NIL, EPQState::origslot, EPQState::parentestate, EPQState::recheckestate, EPQState::recheckplanstate, EPQState::relsubs_slot, and EPQState::tuple_table.
Referenced by apply_handle_delete(), apply_handle_update(), EvalPlanQualSetPlan(), ExecEndLockRows(), and ExecEndModifyTable().
bool EvalPlanQualFetchRowMark | ( | EPQState * | epqstate, |
Index | rti, | ||
TupleTableSlot * | slot | ||
) |
Definition at line 2567 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 | ||
) |
Definition at line 2484 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_done, EPQState::relsubs_rowmark, EPQState::relsubs_slot, and EPQState::tuple_table.
Referenced by apply_handle_delete(), apply_handle_update(), ExecInitLockRows(), and ExecInitModifyTable().
TupleTableSlot* EvalPlanQualNext | ( | EPQState * | epqstate | ) |
Definition at line 2676 of file execMain.c.
References EState::es_query_cxt, ExecProcNode(), MemoryContextSwitchTo(), EPQState::recheckestate, and EPQState::recheckplanstate.
Referenced by EvalPlanQual(), and ExecLockRows().
Definition at line 2522 of file execMain.c.
References EPQState::arowMarks, EvalPlanQualEnd(), and EPQState::plan.
Referenced by ExecInitModifyTable(), and ExecModifyTable().
TupleTableSlot* EvalPlanQualSlot | ( | EPQState * | epqstate, |
Relation | relation, | ||
Index | rti | ||
) |
Definition at line 2539 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(), and ExecUpdate().
Definition at line 2753 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_num_result_relations, EState::es_num_root_result_relations, 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_root_result_relations, EState::es_rowmarks, EState::es_snapshot, EState::es_subplanstates, EState::es_top_eflags, ExecInitNode(), ExecSetParamPlanMulti(), Plan::extParam, ForwardScanDirection, GetPerTupleExprContext, i, ParamExecData::isnull, lappend(), lfirst, list_length(), MemoryContextSwitchTo(), NIL, palloc(), palloc0(), PlannedStmt::paramExecTypes, EPQState::parentestate, EPQState::recheckestate, EPQState::recheckplanstate, EPQState::relsubs_done, EPQState::relsubs_rowmark, ExecAuxRowMark::rowmark, ExecRowMark::rti, PlannedStmt::subplans, and ParamExecData::value.
Referenced by EvalPlanQualBegin().
ExecAuxRowMark* ExecBuildAuxRowMark | ( | ExecRowMark * | erm, |
List * | targetlist | ||
) |
Definition at line 2360 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().
|
static |
Definition at line 2174 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, StringInfoData::len, 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 ExecConstraints(), ExecPartitionCheckEmitError(), and ExecWithCheckOptions().
|
static |
Definition at line 602 of file execMain.c.
References ACL_INSERT, ACL_SELECT, ACL_UPDATE, ACLCHECK_OK, ACLMASK_ALL, ACLMASK_ANY, bms_is_empty(), bms_next_member(), RangeTblEntry::checkAsUser, ExecCheckRTEPermsModified(), FirstLowInvalidHeapAttributeNumber, GetUserId(), RangeTblEntry::insertedCols, InvalidAttrNumber, pg_attribute_aclcheck(), pg_attribute_aclcheck_all(), pg_class_aclmask(), RangeTblEntry::relid, RangeTblEntry::requiredPerms, RTE_RELATION, RangeTblEntry::rtekind, RangeTblEntry::selectedCols, and RangeTblEntry::updatedCols.
Referenced by ExecCheckRTPerms().
|
static |
Definition at line 722 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 ExecCheckRTEPerms().
Definition at line 571 of file execMain.c.
References aclcheck_error(), ACLCHECK_NO_PRIV, Assert, ExecCheckRTEPerms(), ExecutorCheckPerms_hook, get_rel_name(), get_rel_relkind(), get_relkind_objtype(), lfirst, RangeTblEntry::relid, RTE_RELATION, and RangeTblEntry::rtekind.
Referenced by DoCopy(), InitPlan(), intorel_startup(), and RI_Initial_Check().
|
static |
Definition at line 769 of file execMain.c.
References ACL_SELECT, CMD_SELECT, PlannedStmt::commandType, CreateCommandTag(), get_rel_namespace(), PlannedStmt::hasModifyingCTE, isTempNamespace(), lfirst, PreventCommandIfParallelMode(), PreventCommandIfReadOnly(), RangeTblEntry::relid, RangeTblEntry::requiredPerms, PlannedStmt::rtable, RTE_RELATION, and RangeTblEntry::rtekind.
Referenced by standard_ExecutorStart().
void ExecCleanUpTriggerState | ( | EState * | estate | ) |
Definition at line 1454 of file execMain.c.
References Assert, EState::es_trig_target_relations, lfirst, NoLock, 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 1896 of file execMain.c.
References Assert, bms_union(), TupleDescData::constr, convert_tuples_by_name_map_if_req(), ereport, errcode(), errdetail(), errmsg(), ERROR, errtablecol(), errtableconstraint(), ExecBuildSlotValueDescription(), ExecRelCheck(), execute_attr_map_slot(), GetInsertedColumns, GetUpdatedColumns, TupleConstr::has_not_null, MakeTupleTableSlot(), NameStr, TupleDescData::natts, TupleConstr::num_check, RelationGetDescr, RelationGetRelationName, RelationGetRelid, ResultRelInfo::ri_PartitionCheck, ResultRelInfo::ri_PartitionRoot, ResultRelInfo::ri_RelationDesc, slot_attisnull(), TTSOpsVirtual, and TupleDescAttr.
Referenced by CopyFrom(), ExecInsert(), ExecSimpleRelationInsert(), ExecSimpleRelationUpdate(), and ExecUpdate().
Definition at line 1532 of file execMain.c.
References EState::es_num_result_relations, EState::es_range_table_size, EState::es_relations, EState::es_result_relations, EState::es_subplanstates, EState::es_tupleTable, ExecCleanUpTriggerState(), ExecCloseIndices(), ExecEndNode(), ExecResetTupleTable(), i, lfirst, NoLock, and table_close().
Referenced by standard_ExecutorEnd().
ExecRowMark* ExecFindRowMark | ( | EState * | estate, |
Index | rti, | ||
bool | missing_ok | ||
) |
Definition at line 2337 of file execMain.c.
References elog, ERROR, and EState::es_rowmarks.
Referenced by ExecInitLockRows(), and ExecInitModifyTable().
ResultRelInfo* ExecGetTriggerResultRel | ( | EState * | estate, |
Oid | relid | ||
) |
Definition at line 1371 of file execMain.c.
References EState::es_instrument, EState::es_num_result_relations, EState::es_num_root_result_relations, EState::es_query_cxt, EState::es_result_relations, EState::es_root_result_relations, 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 1783 of file execMain.c.
References ExprContext::ecxt_scantuple, ExecCheck(), ExecPartitionCheckEmitError(), ExecPrepareCheck(), GetPerTupleExprContext, ResultRelInfo::ri_PartitionCheck, ResultRelInfo::ri_PartitionCheckExpr, and success.
Referenced by CopyFrom(), ExecFindPartition(), ExecInsert(), ExecSimpleRelationInsert(), ExecSimpleRelationUpdate(), and ExecUpdate().
void ExecPartitionCheckEmitError | ( | ResultRelInfo * | resultRelInfo, |
TupleTableSlot * | slot, | ||
EState * | estate | ||
) |
Definition at line 1828 of file execMain.c.
References bms_union(), convert_tuples_by_name_map_if_req(), ereport, errcode(), errdetail(), errmsg(), ERROR, ExecBuildSlotValueDescription(), execute_attr_map_slot(), GetInsertedColumns, GetUpdatedColumns, MakeTupleTableSlot(), RelationGetDescr, RelationGetRelationName, RelationGetRelid, ResultRelInfo::ri_PartitionRoot, ResultRelInfo::ri_RelationDesc, and TTSOpsVirtual.
Referenced by ExecPartitionCheck(), and ExecUpdate().
|
static |
Definition at line 1486 of file execMain.c.
References EState::es_auxmodifytables, EState::es_direction, ExecProcNode(), ForwardScanDirection, lfirst, ResetPerTupleExprContext, and TupIsNull.
Referenced by standard_ExecutorFinish().
|
static |
Definition at line 1717 of file execMain.c.
References ConstrCheck::ccname, TupleConstr::check, TupleDescData::constr, ExprContext::ecxt_scantuple, EState::es_query_cxt, ExecCheck(), ExecPrepareExpr(), GetPerTupleExprContext, i, MemoryContextSwitchTo(), TupleConstr::num_check, palloc(), RelationData::rd_att, ResultRelInfo::ri_ConstraintExprs, ResultRelInfo::ri_RelationDesc, and stringToNode().
Referenced by ExecConstraints().
LockTupleMode ExecUpdateLockMode | ( | EState * | estate, |
ResultRelInfo * | relinfo | ||
) |
Definition at line 2311 of file execMain.c.
References bms_overlap(), GetAllUpdatedColumns, INDEX_ATTR_BITMAP_KEY, LockTupleExclusive, LockTupleNoKeyExclusive, RelationGetIndexAttrBitmap(), and ResultRelInfo::ri_RelationDesc.
Referenced by ExecBRUpdateTriggers(), and ExecOnConflictUpdate().
|
static |
Definition at line 1601 of file execMain.c.
References CMD_SELECT, 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(), _DestReceiver::receiveSlot, ResetPerTupleExprContext, and TupIsNull.
Referenced by standard_ExecutorRun().
void ExecutorEnd | ( | QueryDesc * | queryDesc | ) |
Definition at line 462 of file execMain.c.
References 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 402 of file execMain.c.
References 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 528 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 301 of file execMain.c.
References ExecutorRun_hook, and standard_ExecutorRun().
Referenced by _SPI_pquery(), CopyTo(), ExecCreateTableAs(), execute_sql_string(), ExplainOnePlan(), ParallelQueryMain(), PersistHoldablePortal(), PortalRunSelect(), postquel_getnext(), ProcessQuery(), and refresh_matview_datafill().
void ExecutorStart | ( | QueryDesc * | queryDesc, |
int | eflags | ||
) |
Definition at line 143 of file execMain.c.
References ExecutorStart_hook, and standard_ExecutorStart().
Referenced by _SPI_pquery(), BeginCopy(), 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 2026 of file execMain.c.
References bms_union(), convert_tuples_by_name_map_if_req(), ExprContext::ecxt_scantuple, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, ExecBuildSlotValueDescription(), ExecQual(), execute_attr_map_slot(), forboth, GetInsertedColumns, GetPerTupleExprContext, GetUpdatedColumns, WithCheckOption::kind, lfirst, MakeTupleTableSlot(), WithCheckOption::polname, RelationGetDescr, RelationGetRelid, WithCheckOption::relname, ResultRelInfo::ri_PartitionRoot, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_WithCheckOptionExprs, ResultRelInfo::ri_WithCheckOptions, TTSOpsVirtual, WCO_RLS_CONFLICT_CHECK, WCO_RLS_INSERT_CHECK, WCO_RLS_UPDATE_CHECK, and WCO_VIEW_CHECK.
Referenced by ExecInsert(), ExecOnConflictUpdate(), and ExecUpdate().
|
static |
Definition at line 806 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_instrument, EState::es_junkFilter, EState::es_num_result_relations, EState::es_num_root_result_relations, EState::es_plannedstmt, EState::es_range_table_size, EState::es_result_relation_info, EState::es_result_relations, EState::es_root_result_relations, EState::es_rowmarks, EState::es_subplanstates, EState::es_tupleTable, QueryDesc::estate, EXEC_FLAG_EXPLAIN_ONLY, EXEC_FLAG_REWIND, EXEC_FLAG_WITH_NO_DATA, exec_rt_fetch(), ExecCheckRTPerms(), ExecGetRangeTableRelation(), ExecGetResultType(), ExecInitExtraTupleSlot(), ExecInitJunkFilter(), ExecInitNode(), ExecInitRangeTable(), i, InitResultRelInfo(), PlanRowMark::isParent, ItemPointerSetInvalid, JunkFilter::jf_cleanTupType, lappend(), lfirst, lfirst_int, list_length(), ExecRowMark::markType, PlanRowMark::markType, NIL, QueryDesc::operation, palloc(), palloc0(), PlanState::plan, QueryDesc::plannedstmt, QueryDesc::planstate, PlannedStmt::planTree, ExecRowMark::prti, PlanRowMark::prti, ExecRowMark::relation, ExecRowMark::relid, RangeTblEntry::relid, TargetEntry::resjunk, PlannedStmt::resultRelations, PlannedStmt::rewindPlanIDs, PlannedStmt::rootResultRelations, 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, | ||
Relation | partition_root, | ||
int | instrument_options | ||
) |
Definition at line 1277 of file execMain.c.
References CopyTriggerDesc(), GetFdwRoutineForRelation(), InstrAlloc(), MemSet, NIL, TriggerDesc::numtriggers, palloc0(), RelationData::rd_rel, RelationGetPartitionQual(), ResultRelInfo::ri_ConstraintExprs, ResultRelInfo::ri_CopyMultiInsertBuffer, ResultRelInfo::ri_FdwRoutine, ResultRelInfo::ri_FdwState, ResultRelInfo::ri_GeneratedExprs, ResultRelInfo::ri_IndexRelationDescs, ResultRelInfo::ri_IndexRelationInfo, ResultRelInfo::ri_junkFilter, ResultRelInfo::ri_NumIndices, ResultRelInfo::ri_onConflict, ResultRelInfo::ri_onConflictArbiterIndexes, ResultRelInfo::ri_PartitionCheck, ResultRelInfo::ri_PartitionInfo, ResultRelInfo::ri_PartitionRoot, ResultRelInfo::ri_projectReturning, ResultRelInfo::ri_RangeTableIndex, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_ReturningSlot, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, ResultRelInfo::ri_TrigNewSlot, ResultRelInfo::ri_TrigOldSlot, ResultRelInfo::ri_TrigWhenExprs, ResultRelInfo::ri_usesFdwDirectModify, T_ResultRelInfo, RelationData::trigdesc, and ResultRelInfo::type.
Referenced by CopyFrom(), create_estate_for_relation(), ExecGetTriggerResultRel(), ExecInitPartitionInfo(), ExecuteTruncateGuts(), and InitPlan().
void standard_ExecutorEnd | ( | QueryDesc * | queryDesc | ) |
Definition at line 471 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 411 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 312 of file execMain.c.
References QueryDesc::already_executed, Assert, CMD_SELECT, QueryDesc::dest, generate_unaccent_rules::dest, elog, ERROR, EState::es_processed, EState::es_query_cxt, EState::es_top_eflags, QueryDesc::estate, EXEC_FLAG_EXPLAIN_ONLY, ExecutePlan(), PlannedStmt::hasReturning, InstrStartNode(), InstrStopNode(), MemoryContextSwitchTo(), QueryDesc::operation, PlannedStmt::parallelModeNeeded, QueryDesc::plannedstmt, QueryDesc::planstate, _DestReceiver::rShutdown, _DestReceiver::rStartup, ScanDirectionIsNoMovement, QueryDesc::totaltime, and QueryDesc::tupDesc.
Referenced by ExecutorRun(), explain_ExecutorRun(), and pgss_ExecutorRun().
void standard_ExecutorStart | ( | QueryDesc * | queryDesc, |
int | eflags | ||
) |
Definition at line 152 of file execMain.c.
References AfterTriggerBeginQuery(), Assert, CMD_DELETE, CMD_INSERT, 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(), 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 76 of file execMain.c.
Referenced by _PG_init(), and ExecCheckRTPerms().
ExecutorEnd_hook_type ExecutorEnd_hook = NULL |
Definition at line 73 of file execMain.c.
Referenced by _PG_fini(), _PG_init(), and ExecutorEnd().
ExecutorFinish_hook_type ExecutorFinish_hook = NULL |
Definition at line 72 of file execMain.c.
Referenced by _PG_fini(), _PG_init(), and ExecutorFinish().
ExecutorRun_hook_type ExecutorRun_hook = NULL |
Definition at line 71 of file execMain.c.
Referenced by _PG_fini(), _PG_init(), and ExecutorRun().
ExecutorStart_hook_type ExecutorStart_hook = NULL |
Definition at line 70 of file execMain.c.
Referenced by _PG_fini(), _PG_init(), and ExecutorStart().