135 (*ExecutorStart_hook) (queryDesc, eflags);
176 queryDesc->
estate = estate;
237 elog(
ERROR,
"unrecognized operation code: %d",
301 (*ExecutorRun_hook) (queryDesc, direction, count);
319 estate = queryDesc->
estate;
340 dest = queryDesc->
dest;
351 dest->rStartup(dest, operation, queryDesc->
tupDesc);
383 dest->rShutdown(dest);
409 (*ExecutorFinish_hook) (queryDesc);
423 estate = queryDesc->
estate;
469 (*ExecutorEnd_hook) (queryDesc);
483 estate = queryDesc->
estate;
544 estate = queryDesc->
estate;
583 bool ereport_on_violation)
588#ifdef USE_ASSERT_CHECKING
596 if (
rte->perminfoindex != 0)
619 foreach(l, rteperminfos)
627 if (ereport_on_violation)
636 result = (*ExecutorCheckPerms_hook) (
rangeTable, rteperminfos,
637 ereport_on_violation);
654 requiredPerms =
perminfo->requiredPerms;
655 Assert(requiredPerms != 0);
780 elog(
ERROR,
"whole-row update is not implemented");
928 erm->relation = relation;
936 erm->ermActive =
false;
1007 foreach(tlist,
plan->targetlist)
1064 switch (resultRel->
rd_rel->relkind)
1089 errmsg(
"cannot change sequence \"%s\"",
1095 errmsg(
"cannot change TOAST relation \"%s\"",
1114 errmsg(
"cannot change materialized view \"%s\"",
1126 errmsg(
"cannot insert into foreign table \"%s\"",
1132 errmsg(
"foreign table \"%s\" does not allow inserts",
1139 errmsg(
"cannot update foreign table \"%s\"",
1145 errmsg(
"foreign table \"%s\" does not allow updates",
1152 errmsg(
"cannot delete from foreign table \"%s\"",
1158 errmsg(
"foreign table \"%s\" does not allow deletes",
1162 elog(
ERROR,
"unrecognized CmdType: %d", (
int) operation);
1169 errmsg(
"cannot change relation \"%s\"",
1186 switch (rel->
rd_rel->relkind)
1196 errmsg(
"cannot lock rows in sequence \"%s\"",
1203 errmsg(
"cannot lock rows in TOAST relation \"%s\"",
1210 errmsg(
"cannot lock rows in view \"%s\"",
1218 errmsg(
"cannot lock rows in materialized view \"%s\"",
1227 errmsg(
"cannot lock rows in foreign table \"%s\"",
1233 errmsg(
"cannot lock rows in relation \"%s\"",
1251 int instrument_options)
1272 if (instrument_options)
1440 if (!partRel->
rd_rel->relispartition)
1441 elog(
ERROR,
"cannot find ancestors of a non-partition result relation");
1604 if (
rInfo->ri_RangeTableIndex > 0)
1742 if (!dest->receiveSlot(slot, dest))
1796 if (ncheck != rel->
rd_rel->relchecks)
1797 elog(
ERROR,
"%d pg_constraint record(s) missing for relation \"%s\"",
1809 for (
int i = 0;
i < ncheck;
i++)
1814 if (!check[
i].ccenforced)
1835 for (
int i = 0;
i < ncheck;
i++)
1966 errmsg(
"new row for relation \"%s\" violates partition constraint",
2030 if (rel->
rd_rel->relchecks > 0)
2066 rel =
rootrel->ri_RelationDesc;
2078 errmsg(
"new row for relation \"%s\" violates check constraint \"%s\"",
2202 rel =
rootrel->ri_RelationDesc;
2215 errmsg(
"null value in column \"%s\" of relation \"%s\" violates not-null constraint",
2261 if (
wco->kind != kind)
2311 rel =
rootrel->ri_RelationDesc;
2324 errmsg(
"new row violates check option for view \"%s\"",
2334 errmsg(
"new row violates row-level security policy \"%s\" for table \"%s\"",
2335 wco->polname,
wco->relname)));
2339 errmsg(
"new row violates row-level security policy for table \"%s\"",
2347 errmsg(
"target row violates row-level security policy \"%s\" (USING expression) for table \"%s\"",
2348 wco->polname,
wco->relname)));
2352 errmsg(
"target row violates row-level security policy (USING expression) for table \"%s\"",
2359 errmsg(
"new row violates row-level security policy \"%s\" (USING expression) for table \"%s\"",
2360 wco->polname,
wco->relname)));
2364 errmsg(
"new row violates row-level security policy (USING expression) for table \"%s\"",
2442 for (
i = 0;
i < tupdesc->
natts;
i++)
2450 if (
att->attisdropped)
2571 elog(
ERROR,
"failed to find ExecRowMark for rangetable index %u", rti);
2611 if (
erm->rti !=
erm->prti)
2724 int epqParam,
List *resultRelations)
2744 epqstate->
plan = subplan;
2768 epqstate->
plan = subplan;
2821 elog(
ERROR,
"EvalPlanQual doesn't support locking rowmarks");
2824 if (
erm->rti !=
erm->prti)
2838 if (tableoid !=
erm->relid)
2868 errmsg(
"cannot lock rows in foreign table \"%s\"",
2877 elog(
ERROR,
"failed to fetch tuple for EvalPlanQual recheck");
2892 elog(
ERROR,
"failed to fetch tuple for EvalPlanQual recheck");
2940 if (recheckestate ==
NULL)
3015 rcestate->es_epq_active = epqstate;
3087 rcestate->es_param_exec_vals[
i].isnull =
AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode, AclMaskHow how)
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult pg_attribute_aclcheck(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mode)
AclMode pg_class_aclmask(Oid table_oid, Oid roleid, AclMode mask, AclMaskHow how)
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
AttrMap * build_attrmap_by_name_if_req(TupleDesc indesc, TupleDesc outdesc, bool missing_ok)
#define AttributeNumberIsValid(attributeNumber)
#define InvalidAttrNumber
void pgstat_report_query_id(int64 query_id, bool force)
int bms_next_member(const Bitmapset *a, int prevbit)
int bms_num_members(const Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_copy(const Bitmapset *a)
#define Assert(condition)
#define MemSet(start, val, len)
#define OidIsValid(objectId)
bool IsInplaceUpdateRelation(Relation relation)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void ExecReScan(PlanState *node)
ExprState * ExecPrepareExpr(Expr *node, EState *estate)
bool ExecCheck(ExprState *state, ExprContext *econtext)
ExprState * ExecPrepareCheck(List *qual, EState *estate)
void ExecCloseIndices(ResultRelInfo *resultRelInfo)
TupleTableSlot * ExecFilterJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName)
JunkFilter * ExecInitJunkFilter(List *targetList, TupleTableSlot *slot)
static void EvalPlanQualStart(EPQState *epqstate, Plan *planTree)
static void ReportNotNullViolationError(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, int attnum)
LockTupleMode ExecUpdateLockMode(EState *estate, ResultRelInfo *relinfo)
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
ExecutorEnd_hook_type ExecutorEnd_hook
ResultRelInfo * ExecGetTriggerResultRel(EState *estate, Oid relid, ResultRelInfo *rootRelInfo)
TupleTableSlot * EvalPlanQualSlot(EPQState *epqstate, Relation relation, Index rti)
void CheckValidResultRel(ResultRelInfo *resultRelInfo, CmdType operation, OnConflictAction onConflictAction, List *mergeActions)
void EvalPlanQualBegin(EPQState *epqstate)
ExecutorFinish_hook_type ExecutorFinish_hook
char * ExecBuildSlotValueDescription(Oid reloid, TupleTableSlot *slot, TupleDesc tupdesc, Bitmapset *modifiedCols, int maxfieldlen)
bool ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, bool emitError)
static void ExecEndPlan(PlanState *planstate, EState *estate)
ExecutorStart_hook_type ExecutorStart_hook
void ExecutorEnd(QueryDesc *queryDesc)
void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations)
void ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook
void InitResultRelInfo(ResultRelInfo *resultRelInfo, Relation resultRelationDesc, Index resultRelationIndex, ResultRelInfo *partition_root_rri, int instrument_options)
void standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
void ExecutorFinish(QueryDesc *queryDesc)
static void CheckValidRowMarkRel(Relation rel, RowMarkType markType)
void EvalPlanQualEnd(EPQState *epqstate)
static void ExecCheckXactReadOnly(PlannedStmt *plannedstmt)
void EvalPlanQualSetPlan(EPQState *epqstate, Plan *subplan, List *auxrowmarks)
void ExecutorRewind(QueryDesc *queryDesc)
void ExecutorStart(QueryDesc *queryDesc, int eflags)
AttrNumber ExecRelGenVirtualNotNull(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate, List *notnull_virtual_attrs)
TupleTableSlot * EvalPlanQual(EPQState *epqstate, Relation relation, Index rti, TupleTableSlot *inputslot)
bool ExecCheckOneRelPerms(RTEPermissionInfo *perminfo)
bool EvalPlanQualFetchRowMark(EPQState *epqstate, Index rti, TupleTableSlot *slot)
static bool ExecCheckPermissionsModified(Oid relOid, Oid userid, Bitmapset *modifiedCols, AclMode requiredPerms)
ExecutorRun_hook_type ExecutorRun_hook
static void ExecPostprocessPlan(EState *estate)
static const char * ExecRelCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
static void ExecutePlan(QueryDesc *queryDesc, CmdType operation, bool sendTuples, uint64 numberTuples, ScanDirection direction, DestReceiver *dest)
void ExecCloseResultRelations(EState *estate)
void standard_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count)
void standard_ExecutorEnd(QueryDesc *queryDesc)
void ExecCloseRangeTableRelations(EState *estate)
void ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate)
static void InitPlan(QueryDesc *queryDesc, int eflags)
bool ExecCheckPermissions(List *rangeTable, List *rteperminfos, bool ereport_on_violation)
void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count)
List * ExecGetAncestorResultRels(EState *estate, ResultRelInfo *resultRelInfo)
TupleTableSlot * EvalPlanQualNext(EPQState *epqstate)
void standard_ExecutorFinish(QueryDesc *queryDesc)
void ExecDoInitialPruning(EState *estate)
void ExecEndNode(PlanState *node)
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
void ExecShutdownNode(PlanState *node)
void CheckCmdReplicaIdentity(Relation rel, CmdType cmd)
void ExecResetTupleTable(List *tupleTable, bool shouldFree)
const TupleTableSlotOps TTSOpsVirtual
TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
void ExecStoreHeapTupleDatum(Datum data, TupleTableSlot *slot)
TupleTableSlot * MakeTupleTableSlot(TupleDesc tupleDesc, const TupleTableSlotOps *tts_ops)
TupleDesc ExecGetResultType(PlanState *planstate)
Relation ExecGetRangeTableRelation(EState *estate, Index rti, bool isResultRel)
Bitmapset * ExecGetInsertedCols(ResultRelInfo *relinfo, EState *estate)
void ExecInitRangeTable(EState *estate, List *rangeTable, List *permInfos, Bitmapset *unpruned_relids)
Bitmapset * ExecGetUpdatedCols(ResultRelInfo *relinfo, EState *estate)
void FreeExecutorState(EState *estate)
Bitmapset * ExecGetAllUpdatedCols(ResultRelInfo *relinfo, EState *estate)
EState * CreateExecutorState(void)
#define EXEC_FLAG_BACKWARD
#define ResetPerTupleExprContext(estate)
#define GetPerTupleExprContext(estate)
void(* ExecutorFinish_hook_type)(QueryDesc *queryDesc)
static RangeTblEntry * exec_rt_fetch(Index rti, EState *estate)
void(* ExecutorRun_hook_type)(QueryDesc *queryDesc, ScanDirection direction, uint64 count)
void(* ExecutorStart_hook_type)(QueryDesc *queryDesc, int eflags)
static bool ExecQual(ExprState *state, ExprContext *econtext)
bool(* ExecutorCheckPerms_hook_type)(List *rangeTable, List *rtePermInfos, bool ereport_on_violation)
void(* ExecutorEnd_hook_type)(QueryDesc *queryDesc)
static TupleTableSlot * ExecProcNode(PlanState *node)
#define EXEC_FLAG_SKIP_TRIGGERS
#define EXEC_FLAG_EXPLAIN_ONLY
static Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull)
#define palloc_object(type)
#define palloc_array(type, count)
#define palloc0_array(type, count)
#define palloc0_object(type)
char * OidOutputFunctionCall(Oid functionId, Datum val)
FdwRoutine * GetFdwRoutineForRelation(Relation relation, bool makecopy)
Instrumentation * InstrAlloc(int n, int instrument_options, bool async_mode)
void InstrStartNode(Instrumentation *instr)
void InstrStopNode(Instrumentation *instr, double nTuples)
static void ItemPointerSetInvalid(ItemPointerData *pointer)
List * lappend(List *list, void *datum)
List * lappend_int(List *list, int datum)
@ LockTupleNoKeyExclusive
char * get_rel_name(Oid relid)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
char get_rel_relkind(Oid relid)
Oid get_rel_namespace(Oid relid)
bool MatViewIncrementalMaintenanceIsEnabled(void)
int pg_mbcliplen(const char *mbstr, int len, int limit)
bool isTempNamespace(Oid namespaceId)
void ExecSetParamPlanMulti(const Bitmapset *params, ExprContext *econtext)
ObjectType get_relkind_objtype(char relkind)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
RTEPermissionInfo * getRTEPermissionInfo(List *rteperminfos, RangeTblEntry *rte)
@ WCO_RLS_MERGE_UPDATE_CHECK
@ WCO_RLS_MERGE_DELETE_CHECK
List * RelationGetPartitionQual(Relation rel)
List * get_partition_ancestors(Oid relid)
FormData_pg_attribute * Form_pg_attribute
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define forboth(cell1, list1, cell2, list2)
#define foreach_current_index(var_or_cell)
#define foreach_node(type, var, lst)
#define foreach_int(var, lst)
static char buf[DEFAULT_XLOG_SEG_SIZE]
void pgstat_update_parallel_workers_stats(PgStat_Counter workers_to_launch, PgStat_Counter workers_launched)
#define RowMarkRequiresRowShareLock(marktype)
@ ROW_MARK_NOKEYEXCLUSIVE
static Oid DatumGetObjectId(Datum X)
static Pointer DatumGetPointer(Datum X)
@ MERGE_WHEN_NOT_MATCHED_BY_TARGET
@ MERGE_WHEN_NOT_MATCHED_BY_SOURCE
void * stringToNode(const char *str)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
int errtableconstraint(Relation rel, const char *conname)
int errtablecol(Relation rel, int attnum)
Bitmapset * RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
int errtable(Relation rel)
bool view_has_instead_trigger(Relation view, CmdType event, List *mergeActionList)
Node * build_generation_expression(Relation rel, int attrno)
void error_view_not_updatable(Relation view, CmdType command, List *mergeActionList, const char *detail)
Node * expand_generated_columns_in_expr(Node *node, Relation rel, int rt_index)
int check_enable_rls(Oid relid, Oid checkAsUser, bool noError)
#define ScanDirectionIsNoMovement(direction)
void UnregisterSnapshot(Snapshot snapshot)
Snapshot RegisterSnapshot(Snapshot snapshot)
Snapshot GetActiveSnapshot(void)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
ExecAuxRowMark ** relsubs_rowmark
TupleTableSlot * origslot
TupleTableSlot ** relsubs_slot
PlanState * recheckplanstate
List * es_part_prune_infos
int es_parallel_workers_to_launch
List * es_tuple_routing_result_relations
PlannedStmt * es_plannedstmt
QueryEnvironment * es_queryEnv
ParamExecData * es_param_exec_vals
uint64 es_total_processed
Bitmapset * es_unpruned_relids
List * es_part_prune_states
ParamListInfo es_param_list_info
ExecRowMark ** es_rowmarks
MemoryContext es_query_cxt
ScanDirection es_direction
struct EPQState * es_epq_active
PartitionDirectory es_partition_directory
List * es_trig_target_relations
List * es_opened_result_relations
bool es_use_parallel_mode
int es_parallel_workers_launched
Index es_range_table_size
const char * es_sourceText
List * es_auxmodifytables
JunkFilter * es_junkFilter
List * es_part_prune_results
Snapshot es_crosscheck_snapshot
TupleTableSlot * ecxt_scantuple
ExecForeignInsert_function ExecForeignInsert
ExecForeignUpdate_function ExecForeignUpdate
RefetchForeignRow_function RefetchForeignRow
ExecForeignDelete_function ExecForeignDelete
IsForeignRelUpdatable_function IsForeignRelUpdatable
TupleDesc jf_cleanTupType
LockClauseStrength strength
LockWaitPolicy waitPolicy
Bitmapset * rewindPlanIDs
Bitmapset * unprunableRelids
PlannedStmt * plannedstmt
struct Instrumentation * totaltime
QueryEnvironment * queryEnv
Snapshot crosscheck_snapshot
TupleConversionMap * ri_RootToChildMap
ExprState ** ri_CheckConstraintExprs
TupleTableSlot * ri_PartitionTupleSlot
bool ri_projectNewInfoValid
OnConflictSetState * ri_onConflict
List * ri_onConflictArbiterIndexes
struct ResultRelInfo * ri_RootResultRelInfo
ExprState * ri_PartitionCheckExpr
Instrumentation * ri_TrigInstrument
ExprState * ri_MergeJoinCondition
RelationPtr ri_IndexRelationDescs
TupleTableSlot * ri_ReturningSlot
List * ri_WithCheckOptions
TupleTableSlot * ri_oldTupleSlot
bool ri_RootToChildMapValid
struct CopyMultiInsertBuffer * ri_CopyMultiInsertBuffer
TriggerDesc * ri_TrigDesc
TupleTableSlot * ri_AllNullSlot
ExprState ** ri_GenVirtualNotNullConstraintExprs
Bitmapset * ri_extraUpdatedCols
ExprState ** ri_GeneratedExprsI
TupleConversionMap * ri_ChildToRootMap
bool ri_ChildToRootMapValid
List * ri_MergeActions[NUM_MERGE_MATCH_KINDS]
List * ri_ancestorResultRels
TupleTableSlot * ri_newTupleSlot
List * ri_WithCheckOptionExprs
ProjectionInfo * ri_projectNew
ProjectionInfo * ri_projectReturning
ExprState ** ri_GeneratedExprsU
struct FdwRoutine * ri_FdwRoutine
ExprState ** ri_TrigWhenExprs
FmgrInfo * ri_TrigFunctions
bool ri_usesFdwDirectModify
IndexInfo ** ri_IndexRelationInfo
TupleTableSlot * ri_TrigNewSlot
TupleTableSlot * ri_TrigOldSlot
#define FirstLowInvalidHeapAttributeNumber
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
static bool table_tuple_fetch_row_version(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot)
TriggerDesc * CopyTriggerDesc(TriggerDesc *trigdesc)
void AfterTriggerEndQuery(EState *estate)
void AfterTriggerBeginQuery(void)
TupleTableSlot * execute_attr_map_slot(AttrMap *attrMap, TupleTableSlot *in_slot, TupleTableSlot *out_slot)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
static void slot_getallattrs(TupleTableSlot *slot)
static TupleTableSlot * ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
static void ExecMaterializeSlot(TupleTableSlot *slot)
static bool slot_attisnull(TupleTableSlot *slot, int attnum)
void PreventCommandIfReadOnly(const char *cmdname)
void PreventCommandIfParallelMode(const char *cmdname)
static const char * CreateCommandName(Node *parsetree)
void ExitParallelMode(void)
void EnterParallelMode(void)
bool IsInParallelMode(void)
CommandId GetCurrentCommandId(bool used)