PostgreSQL Source Code
git master
|
#include "access/tableam.h"
#include "catalog/objectaddress.h"
#include "nodes/execnodes.h"
#include "nodes/parsenodes.h"
Go to the source code of this file.
Data Structures | |
struct | TriggerData |
struct | TransitionCaptureState |
Typedefs | |
typedef uint32 | TriggerEvent |
typedef struct TriggerData | TriggerData |
typedef struct TransitionCaptureState | TransitionCaptureState |
Variables | |
PGDLLIMPORT int | SessionReplicationRole |
#define CALLED_AS_TRIGGER | ( | fcinfo | ) | ((fcinfo)->context != NULL && IsA((fcinfo)->context, TriggerData)) |
#define RI_TRIGGER_FK 2 /* is a trigger on the FK relation */ |
#define RI_TRIGGER_NONE 0 /* is not an RI trigger function */ |
#define RI_TRIGGER_PK 1 /* is a trigger on the PK relation */ |
#define TRIGGER_FIRED_AFTER | ( | event | ) | (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_AFTER) |
#define TRIGGER_FIRED_BEFORE | ( | event | ) | (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_BEFORE) |
#define TRIGGER_FIRED_BY_DELETE | ( | event | ) | (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_DELETE) |
#define TRIGGER_FIRED_BY_INSERT | ( | event | ) | (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_INSERT) |
#define TRIGGER_FIRED_BY_TRUNCATE | ( | event | ) | (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_TRUNCATE) |
#define TRIGGER_FIRED_BY_UPDATE | ( | event | ) | (((event) & TRIGGER_EVENT_OPMASK) == TRIGGER_EVENT_UPDATE) |
#define TRIGGER_FIRED_FOR_ROW | ( | event | ) | ((event) & TRIGGER_EVENT_ROW) |
#define TRIGGER_FIRED_FOR_STATEMENT | ( | event | ) | (!TRIGGER_FIRED_FOR_ROW(event)) |
#define TRIGGER_FIRED_INSTEAD | ( | event | ) | (((event) & TRIGGER_EVENT_TIMINGMASK) == TRIGGER_EVENT_INSTEAD) |
typedef struct TransitionCaptureState TransitionCaptureState |
typedef struct TriggerData TriggerData |
typedef uint32 TriggerEvent |
void AfterTriggerBeginQuery | ( | void | ) |
Definition at line 5024 of file trigger.c.
References afterTriggers, and AfterTriggersData::query_depth.
Referenced by CopyFrom(), create_edata_for_relation(), ExecuteTruncateGuts(), and standard_ExecutorStart().
void AfterTriggerBeginSubXact | ( | void | ) |
Definition at line 5307 of file trigger.c.
References afterTriggers, AfterTriggersData::events, AfterTriggersTransData::events, AfterTriggersData::firing_counter, AfterTriggersTransData::firing_counter, GetCurrentTransactionNestLevel(), AfterTriggersData::maxtransdepth, MemoryContextAlloc(), AfterTriggersData::query_depth, AfterTriggersTransData::query_depth, repalloc(), AfterTriggersTransData::state, TopTransactionContext, and AfterTriggersData::trans_stack.
Referenced by StartSubTransaction().
void AfterTriggerBeginXact | ( | void | ) |
Definition at line 4992 of file trigger.c.
References afterTriggers, Assert, AfterTriggersData::event_cxt, AfterTriggersData::events, AfterTriggersData::firing_counter, AfterTriggerEventList::head, AfterTriggersData::maxquerydepth, AfterTriggersData::maxtransdepth, AfterTriggersData::query_depth, AfterTriggersData::query_stack, AfterTriggersData::state, and AfterTriggersData::trans_stack.
Referenced by StartTransaction().
void AfterTriggerEndQuery | ( | EState * | estate | ) |
Definition at line 5044 of file trigger.c.
References afterTriggerDeleteHeadEventChunk(), AfterTriggerFreeQuery(), afterTriggerInvokeEvents(), afterTriggerMarkEvents(), afterTriggers, Assert, AfterTriggersData::events, AfterTriggersQueryData::events, AfterTriggersData::firing_counter, AfterTriggerEventList::head, AfterTriggersData::maxquerydepth, AfterTriggersData::query_depth, AfterTriggersData::query_stack, and AfterTriggerEventList::tail.
Referenced by CopyFrom(), ExecuteTruncateGuts(), finish_edata(), and standard_ExecutorFinish().
void AfterTriggerEndSubXact | ( | bool | isCommit | ) |
Definition at line 5355 of file trigger.c.
References AFTER_TRIGGER_DONE, AFTER_TRIGGER_IN_PROGRESS, AfterTriggerFreeQuery(), afterTriggerRestoreEventList(), afterTriggers, Assert, AfterTriggerEventData::ate_flags, AfterTriggerSharedData::ats_firing_id, chunk, AfterTriggersData::events, AfterTriggersTransData::events, AfterTriggersTransData::firing_counter, for_each_event_chunk, GetCurrentTransactionNestLevel(), GetTriggerSharedData, AfterTriggersData::maxquerydepth, AfterTriggersData::maxtransdepth, pfree(), AfterTriggersData::query_depth, AfterTriggersTransData::query_depth, AfterTriggersData::query_stack, AfterTriggersData::state, AfterTriggersTransData::state, and AfterTriggersData::trans_stack.
Referenced by AbortSubTransaction(), and CommitSubTransaction().
void AfterTriggerEndXact | ( | bool | isCommit | ) |
Definition at line 5259 of file trigger.c.
References afterTriggers, AfterTriggersData::event_cxt, AfterTriggersData::events, AfterTriggerEventList::head, AfterTriggersData::maxquerydepth, AfterTriggersData::maxtransdepth, MemoryContextDelete(), AfterTriggersData::query_depth, AfterTriggersData::query_stack, AfterTriggersData::state, AfterTriggerEventList::tail, AfterTriggerEventList::tailfree, and AfterTriggersData::trans_stack.
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
void AfterTriggerFireDeferred | ( | void | ) |
Definition at line 5203 of file trigger.c.
References afterTriggerInvokeEvents(), afterTriggerMarkEvents(), afterTriggers, Assert, AfterTriggersData::events, AfterTriggersData::firing_counter, GetTransactionSnapshot(), AfterTriggerEventList::head, PopActiveSnapshot(), PushActiveSnapshot(), and AfterTriggersData::query_depth.
Referenced by CommitTransaction(), and PrepareTransaction().
bool AfterTriggerPendingOnRel | ( | Oid | relid | ) |
Definition at line 5980 of file trigger.c.
References AFTER_TRIGGER_DONE, afterTriggers, AfterTriggerEventData::ate_flags, AfterTriggerSharedData::ats_relid, chunk, AfterTriggersData::events, AfterTriggersQueryData::events, for_each_event_chunk, GetTriggerSharedData, AfterTriggersData::maxquerydepth, AfterTriggersData::query_depth, and AfterTriggersData::query_stack.
Referenced by CheckTableNotInUse().
void AfterTriggerSetState | ( | ConstraintsSetStmt * | stmt | ) |
Definition at line 5665 of file trigger.c.
References AccessShareLock, afterTriggerInvokeEvents(), afterTriggerMarkEvents(), afterTriggers, SetConstraintStateData::all_isdeferred, SetConstraintStateData::all_isset, BTEqualStrategyNumber, RangeVar::catalogname, CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, AfterTriggersData::events, fetch_search_path(), AfterTriggersData::firing_counter, get_database_name(), GetCurrentTransactionNestLevel(), GETSTRUCT, GetTransactionSnapshot(), HeapTupleIsValid, i, IsSubTransaction(), sort-test::key, lappend_oid(), lfirst, lfirst_oid, list_free(), list_make1_oid, LookupExplicitNamespace(), MyDatabaseId, NIL, SetConstraintStateData::numstates, ObjectIdGetDatum(), PopActiveSnapshot(), PushActiveSnapshot(), RangeVar::relname, ScanKeyInit(), RangeVar::schemaname, SetConstraintStateAddItem(), SetConstraintStateCopy(), SetConstraintStateCreate(), AfterTriggersData::state, AfterTriggersTransData::state, stmt, systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), and AfterTriggersData::trans_stack.
Referenced by standard_ProcessUtility().
TriggerDesc* CopyTriggerDesc | ( | TriggerDesc * | trigdesc | ) |
Definition at line 2086 of file trigger.c.
References i, j, TriggerDesc::numtriggers, palloc(), pstrdup(), Trigger::tgargs, Trigger::tgattr, Trigger::tgname, Trigger::tgnargs, Trigger::tgnattr, Trigger::tgnewtable, Trigger::tgoldtable, Trigger::tgqual, and TriggerDesc::triggers.
Referenced by InitResultRelInfo(), and RelationBuildTriggers().
ObjectAddress CreateTrigger | ( | CreateTrigStmt * | stmt, |
const char * | queryString, | ||
Oid | relOid, | ||
Oid | refRelOid, | ||
Oid | constraintOid, | ||
Oid | indexOid, | ||
Oid | funcoid, | ||
Oid | parentTriggerOid, | ||
Node * | whenClause, | ||
bool | isInternal, | ||
bool | in_partition | ||
) |
Definition at line 158 of file trigger.c.
References CreateTriggerFiringOn(), stmt, and TRIGGER_FIRES_ON_ORIGIN.
Referenced by CreateFKCheckTrigger(), createForeignKeyActionTriggers(), index_constraint_create(), and ProcessUtilitySlow().
ObjectAddress CreateTriggerFiringOn | ( | CreateTrigStmt * | stmt, |
const char * | queryString, | ||
Oid | relOid, | ||
Oid | refRelOid, | ||
Oid | constraintOid, | ||
Oid | indexOid, | ||
Oid | funcoid, | ||
Oid | parentTriggerOid, | ||
Node * | whenClause, | ||
bool | isInternal, | ||
bool | in_partition, | ||
char | trigger_fires_when | ||
) |
Definition at line 175 of file trigger.c.
References AccessShareLock, ACL_EXECUTE, ACL_TRIGGER, aclcheck_error(), ACLCHECK_OK, addNSItemToQuery(), addRangeTableEntryForRelation(), ALLOCSET_SMALL_SIZES, AllocSetContextCreate, allowSystemTableMods, generate_unaccent_rules::args, Assert, assign_expr_collations(), attnameAttNum(), attnum, BoolGetDatum(), BTEqualStrategyNumber, buildint2vector(), byteain(), CacheInvalidateRelcacheByTuple(), CatalogTupleInsert(), CatalogTupleUpdate(), ObjectAddress::classId, CommandCounterIncrement(), copyObject, CreateConstraintEntry(), CStringGetDatum(), CStringGetTextDatum, CurrentMemoryContext, DatumGetPointer(), deleteDependencyRecordsFor(), DEPENDENCY_AUTO, DEPENDENCY_INTERNAL, DEPENDENCY_NORMAL, DEPENDENCY_PARTITION_PRI, DEPENDENCY_PARTITION_SEC, DirectFunctionCall1, elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errdetail(), errdetail_relkind_not_supported(), errhint(), errmsg(), ERROR, EXPR_KIND_TRIGGER_WHEN, find_all_inheritors(), free_parsestate(), CreateTrigStmt::funcname, get_func_rettype(), get_rel_name(), get_rel_relkind(), get_relkind_objtype(), GetNewOidWithIndex(), GETSTRUCT, GetUserId(), has_superclass(), heap_copytuple(), heap_form_tuple(), heap_freetuple(), HeapTupleIsValid, i, Int16GetDatum(), InvalidAttrNumber, InvalidOid, InvokeObjectPostCreateHookArg, TriggerTransition::isNew, IsSystemRelation(), TriggerTransition::isTable, j, len, lfirst, lfirst_node, list_free(), list_length(), Var::location, LockRelationOid(), LookupFuncName(), make_parsestate(), makeAlias(), map_partition_varattnos(), MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), name, TriggerTransition::name, NAMEDATALEN, namein(), NameListToString(), NameStr, NIL, nodeToString(), NoLock, PartitionDescData::nparts, object_aclcheck(), OBJECT_FUNCTION, ObjectAddressSet, ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, OidIsValid, PartitionDescData::oids, ParseState::p_rtable, ParseState::p_sourcetext, palloc(), parser_errposition(), pfree(), pg_class_aclcheck(), PointerGetDatum(), PRS2_NEW_VARNO, PRS2_OLD_VARNO, pull_var_clause(), RangeVarGetRelid, RelationData::rd_att, RelationData::rd_id, RelationData::rd_rel, recordDependencyOn(), recordDependencyOnExpr(), RelationGetDescr, RelationGetNamespace, RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), SearchSysCacheCopy1, ShareRowExclusiveLock, snprintf, stmt, strVal, systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), table_open(), table_openrv(), transformWhereClause(), TupleDescAttr, values, Var::varattno, Var::varno, and CreateTrigStmt::whenClause.
Referenced by CloneRowTriggersToPartition(), and CreateTrigger().
void EnableDisableTrigger | ( | Relation | rel, |
const char * | tgname, | ||
Oid | tgparent, | ||
char | fires_when, | ||
bool | skip_system, | ||
bool | recurse, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 1722 of file trigger.c.
References BTEqualStrategyNumber, CacheInvalidateRelcache(), CatalogTupleUpdate(), CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, GETSTRUCT, heap_copytuple(), heap_freetuple(), HeapTupleIsValid, i, InvokeObjectPostAlterHook, NameStr, NoLock, PartitionDescData::nparts, ObjectIdGetDatum(), OidIsValid, PartitionDescData::oids, RelationData::rd_rel, relation_open(), RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), superuser(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecEnableDisableTrigger().
void ExecARDeleteTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
ItemPointer | tupleid, | ||
HeapTuple | fdw_trigtuple, | ||
TransitionCaptureState * | transition_capture, | ||
bool | is_crosspart_update | ||
) |
Definition at line 2775 of file trigger.c.
References AfterTriggerSaveEvent(), Assert, ExecForceStoreHeapTuple(), ExecGetTriggerOldSlot(), GetTupleForTrigger(), HeapTupleIsValid, ItemPointerIsValid(), LockTupleExclusive, NIL, ResultRelInfo::ri_TrigDesc, TransitionCaptureState::tcs_delete_old_table, TriggerDesc::trig_delete_after_row, and TRIGGER_EVENT_DELETE.
Referenced by ExecDeleteEpilogue(), and ExecSimpleRelationDelete().
void ExecARInsertTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
TupleTableSlot * | slot, | ||
List * | recheckIndexes, | ||
TransitionCaptureState * | transition_capture | ||
) |
Definition at line 2535 of file trigger.c.
References AfterTriggerSaveEvent(), ResultRelInfo::ri_TrigDesc, TransitionCaptureState::tcs_insert_new_table, TriggerDesc::trig_insert_after_row, and TRIGGER_EVENT_INSERT.
Referenced by CopyFrom(), CopyMultiInsertBufferFlush(), ExecBatchInsert(), ExecInsert(), and ExecSimpleRelationInsert().
void ExecARUpdateTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
ResultRelInfo * | src_partinfo, | ||
ResultRelInfo * | dst_partinfo, | ||
ItemPointer | tupleid, | ||
HeapTuple | fdw_trigtuple, | ||
TupleTableSlot * | newslot, | ||
List * | recheckIndexes, | ||
TransitionCaptureState * | transition_capture, | ||
bool | is_crosspart_update | ||
) |
Definition at line 3098 of file trigger.c.
References AfterTriggerSaveEvent(), Assert, ExecClearTuple(), ExecForceStoreHeapTuple(), ExecGetAllUpdatedCols(), ExecGetTriggerOldSlot(), GetTupleForTrigger(), ItemPointerIsValid(), LockTupleExclusive, ResultRelInfo::ri_TrigDesc, TransitionCaptureState::tcs_update_new_table, TransitionCaptureState::tcs_update_old_table, TriggerDesc::trig_update_after_row, and TRIGGER_EVENT_UPDATE.
Referenced by ExecCrossPartitionUpdateForeignKey(), ExecDeleteEpilogue(), ExecInsert(), ExecSimpleRelationUpdate(), and ExecUpdateEpilogue().
void ExecASDeleteTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
TransitionCaptureState * | transition_capture | ||
) |
Definition at line 2664 of file trigger.c.
References AfterTriggerSaveEvent(), NIL, ResultRelInfo::ri_TrigDesc, TriggerDesc::trig_delete_after_statement, and TRIGGER_EVENT_DELETE.
Referenced by fireASTriggers().
void ExecASInsertTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
TransitionCaptureState * | transition_capture | ||
) |
Definition at line 2446 of file trigger.c.
References AfterTriggerSaveEvent(), NIL, ResultRelInfo::ri_TrigDesc, TriggerDesc::trig_insert_after_statement, and TRIGGER_EVENT_INSERT.
Referenced by CopyFrom(), and fireASTriggers().
void ExecASTruncateTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo | ||
) |
Definition at line 3270 of file trigger.c.
References AfterTriggerSaveEvent(), NIL, ResultRelInfo::ri_TrigDesc, TriggerDesc::trig_truncate_after_statement, and TRIGGER_EVENT_TRUNCATE.
Referenced by ExecuteTruncateGuts().
void ExecASUpdateTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
TransitionCaptureState * | transition_capture | ||
) |
Definition at line 2917 of file trigger.c.
References AfterTriggerSaveEvent(), Assert, ExecGetAllUpdatedCols(), NIL, ResultRelInfo::ri_RootResultRelInfo, ResultRelInfo::ri_TrigDesc, TriggerDesc::trig_update_after_statement, and TRIGGER_EVENT_UPDATE.
Referenced by fireASTriggers().
bool ExecBRDeleteTriggers | ( | EState * | estate, |
EPQState * | epqstate, | ||
ResultRelInfo * | relinfo, | ||
ItemPointer | tupleid, | ||
HeapTuple | fdw_trigtuple, | ||
TupleTableSlot ** | epqslot, | ||
TM_Result * | tmresult, | ||
TM_FailureData * | tmfd | ||
) |
Definition at line 2684 of file trigger.c.
References Assert, ExecCallTriggerFunc(), ExecFetchSlotHeapTuple(), ExecForceStoreHeapTuple(), ExecGetTriggerOldSlot(), GetPerTupleMemoryContext, GetTupleForTrigger(), heap_freetuple(), HeapTupleIsValid, i, ItemPointerIsValid(), LockTupleExclusive, TriggerDesc::numtriggers, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigslot, TriggerData::tg_trigtuple, Trigger::tgtype, TRIGGER_EVENT_BEFORE, TRIGGER_EVENT_DELETE, TRIGGER_EVENT_ROW, TriggerEnabled(), TriggerDesc::triggers, and TriggerData::type.
Referenced by ExecDeletePrologue(), and ExecSimpleRelationDelete().
bool ExecBRInsertTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
TupleTableSlot * | slot | ||
) |
Definition at line 2459 of file trigger.c.
References ereport, errcode(), errdetail(), errmsg(), ERROR, ExecCallTriggerFunc(), ExecFetchSlotHeapTuple(), ExecForceStoreHeapTuple(), ExecPartitionCheck(), get_namespace_name(), GetPerTupleMemoryContext, heap_freetuple(), i, TriggerDesc::numtriggers, RelationGetNamespace, RelationGetRelationName, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigslot, TriggerData::tg_trigtuple, Trigger::tgisclone, Trigger::tgname, Trigger::tgtype, TRIGGER_EVENT_BEFORE, TRIGGER_EVENT_INSERT, TRIGGER_EVENT_ROW, TriggerEnabled(), TriggerDesc::triggers, and TriggerData::type.
Referenced by CopyFrom(), ExecInsert(), and ExecSimpleRelationInsert().
bool ExecBRUpdateTriggers | ( | EState * | estate, |
EPQState * | epqstate, | ||
ResultRelInfo * | relinfo, | ||
ItemPointer | tupleid, | ||
HeapTuple | fdw_trigtuple, | ||
TupleTableSlot * | newslot, | ||
TM_Result * | tmresult, | ||
TM_FailureData * | tmfd | ||
) |
Definition at line 2935 of file trigger.c.
References Assert, ExecCallTriggerFunc(), ExecCopySlot(), ExecFetchSlotHeapTuple(), ExecForceStoreHeapTuple(), ExecGetAllUpdatedCols(), ExecGetTriggerOldSlot(), ExecGetUpdateNewTuple(), ExecMaterializeSlot(), ExecUpdateLockMode(), GetPerTupleMemoryContext, GetTupleForTrigger(), heap_freetuple(), HeapTupleIsValid, i, ItemPointerIsValid(), TriggerDesc::numtriggers, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_newslot, TriggerData::tg_newtuple, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigslot, TriggerData::tg_trigtuple, TriggerData::tg_updatedcols, Trigger::tgtype, TRIGGER_EVENT_BEFORE, TRIGGER_EVENT_ROW, TRIGGER_EVENT_UPDATE, TriggerEnabled(), TriggerDesc::triggers, TriggerData::type, and unlikely.
Referenced by ExecSimpleRelationUpdate(), and ExecUpdatePrologue().
void ExecBSDeleteTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo | ||
) |
Definition at line 2613 of file trigger.c.
References before_stmt_triggers_fired(), CMD_DELETE, ereport, errcode(), errmsg(), ERROR, ExecCallTriggerFunc(), GetPerTupleMemoryContext, i, TriggerDesc::numtriggers, RelationGetRelid, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_relation, TriggerData::tg_trigger, Trigger::tgtype, TriggerDesc::trig_delete_before_statement, TRIGGER_EVENT_BEFORE, TRIGGER_EVENT_DELETE, TriggerEnabled(), TriggerDesc::triggers, and TriggerData::type.
Referenced by fireBSTriggers().
void ExecBSInsertTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo | ||
) |
Definition at line 2395 of file trigger.c.
References before_stmt_triggers_fired(), CMD_INSERT, ereport, errcode(), errmsg(), ERROR, ExecCallTriggerFunc(), GetPerTupleMemoryContext, i, TriggerDesc::numtriggers, RelationGetRelid, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_relation, TriggerData::tg_trigger, Trigger::tgtype, TriggerDesc::trig_insert_before_statement, TRIGGER_EVENT_BEFORE, TRIGGER_EVENT_INSERT, TriggerEnabled(), TriggerDesc::triggers, and TriggerData::type.
Referenced by CopyFrom(), and fireBSTriggers().
void ExecBSTruncateTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo | ||
) |
Definition at line 3223 of file trigger.c.
References ereport, errcode(), errmsg(), ERROR, ExecCallTriggerFunc(), GetPerTupleMemoryContext, i, TriggerDesc::numtriggers, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_relation, TriggerData::tg_trigger, Trigger::tgtype, TriggerDesc::trig_truncate_before_statement, TRIGGER_EVENT_BEFORE, TRIGGER_EVENT_TRUNCATE, TriggerEnabled(), TriggerDesc::triggers, and TriggerData::type.
Referenced by ExecuteTruncateGuts().
void ExecBSUpdateTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo | ||
) |
Definition at line 2859 of file trigger.c.
References Assert, before_stmt_triggers_fired(), CMD_UPDATE, ereport, errcode(), errmsg(), ERROR, ExecCallTriggerFunc(), ExecGetAllUpdatedCols(), GetPerTupleMemoryContext, i, TriggerDesc::numtriggers, RelationGetRelid, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_RootResultRelInfo, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_updatedcols, Trigger::tgtype, TriggerDesc::trig_update_before_statement, TRIGGER_EVENT_BEFORE, TRIGGER_EVENT_UPDATE, TriggerEnabled(), TriggerDesc::triggers, and TriggerData::type.
Referenced by fireBSTriggers().
bool ExecIRDeleteTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
HeapTuple | trigtuple | ||
) |
Definition at line 2812 of file trigger.c.
References ExecCallTriggerFunc(), ExecForceStoreHeapTuple(), ExecGetTriggerOldSlot(), GetPerTupleMemoryContext, heap_freetuple(), i, TriggerDesc::numtriggers, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigslot, TriggerData::tg_trigtuple, Trigger::tgtype, TRIGGER_EVENT_DELETE, TRIGGER_EVENT_INSTEAD, TRIGGER_EVENT_ROW, TriggerEnabled(), TriggerDesc::triggers, and TriggerData::type.
Referenced by ExecDelete(), and ExecMergeMatched().
bool ExecIRInsertTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
TupleTableSlot * | slot | ||
) |
Definition at line 2552 of file trigger.c.
References ExecCallTriggerFunc(), ExecFetchSlotHeapTuple(), ExecForceStoreHeapTuple(), GetPerTupleMemoryContext, heap_freetuple(), i, TriggerDesc::numtriggers, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigslot, TriggerData::tg_trigtuple, Trigger::tgtype, TRIGGER_EVENT_INSERT, TRIGGER_EVENT_INSTEAD, TRIGGER_EVENT_ROW, TriggerEnabled(), TriggerDesc::triggers, and TriggerData::type.
Referenced by CopyFrom(), and ExecInsert().
bool ExecIRUpdateTriggers | ( | EState * | estate, |
ResultRelInfo * | relinfo, | ||
HeapTuple | trigtuple, | ||
TupleTableSlot * | newslot | ||
) |
Definition at line 3157 of file trigger.c.
References ExecCallTriggerFunc(), ExecFetchSlotHeapTuple(), ExecForceStoreHeapTuple(), ExecGetTriggerOldSlot(), GetPerTupleMemoryContext, heap_freetuple(), i, TriggerDesc::numtriggers, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_TrigFunctions, ResultRelInfo::ri_TrigInstrument, TriggerData::tg_event, TriggerData::tg_newslot, TriggerData::tg_newtuple, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigslot, TriggerData::tg_trigtuple, Trigger::tgtype, TRIGGER_EVENT_INSTEAD, TRIGGER_EVENT_ROW, TRIGGER_EVENT_UPDATE, TriggerEnabled(), TriggerDesc::triggers, and TriggerData::type.
Referenced by ExecMergeMatched(), and ExecUpdate().
const char* FindTriggerIncompatibleWithInheritance | ( | TriggerDesc * | trigdesc | ) |
Definition at line 2273 of file trigger.c.
References i, TriggerDesc::numtriggers, Trigger::tgname, Trigger::tgnewtable, Trigger::tgoldtable, and TriggerDesc::triggers.
Referenced by ATExecAddInherit(), and ATExecAttachPartition().
void FreeTriggerDesc | ( | TriggerDesc * | trigdesc | ) |
Definition at line 2141 of file trigger.c.
References i, TriggerDesc::numtriggers, pfree(), Trigger::tgargs, Trigger::tgattr, Trigger::tgname, Trigger::tgnargs, Trigger::tgnattr, Trigger::tgnewtable, Trigger::tgoldtable, Trigger::tgqual, and TriggerDesc::triggers.
Referenced by RelationBuildTriggers(), and RelationDestroyRelation().
Definition at line 1366 of file trigger.c.
References AccessShareLock, BTEqualStrategyNumber, CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, get_rel_name(), GETSTRUCT, HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by get_object_address_relobject().
TransitionCaptureState* MakeTransitionCaptureState | ( | TriggerDesc * | trigdesc, |
Oid | relid, | ||
CmdType | cmdType | ||
) |
Definition at line 4888 of file trigger.c.
References AfterTriggerEnlargeQueryState(), afterTriggers, CMD_DELETE, CMD_INSERT, CMD_MERGE, CMD_UPDATE, CurrentResourceOwner, CurTransactionContext, CurTransactionResourceOwner, elog, ERROR, GetAfterTriggersTableData(), AfterTriggersData::maxquerydepth, MemoryContextSwitchTo(), AfterTriggersTableData::new_ins_tuplestore, AfterTriggersTableData::new_upd_tuplestore, AfterTriggersTableData::old_del_tuplestore, AfterTriggersTableData::old_upd_tuplestore, palloc0(), AfterTriggersData::query_depth, TriggerDesc::trig_delete_old_table, TriggerDesc::trig_insert_new_table, TriggerDesc::trig_update_new_table, TriggerDesc::trig_update_old_table, tuplestore_begin_heap(), and work_mem.
Referenced by CopyFrom(), and ExecSetupTransitionCaptureState().
void RelationBuildTriggers | ( | Relation | relation | ) |
Definition at line 1857 of file trigger.c.
References AccessShareLock, BTEqualStrategyNumber, CacheMemoryContext, CopyTriggerDesc(), DatumGetByteaPP, DatumGetCString(), DirectFunctionCall1, elog, ERROR, fastgetattr(), FreeTriggerDesc(), GETSTRUCT, HeapTupleIsValid, i, MemoryContextSwitchTo(), NameGetDatum(), nameout(), TriggerDesc::numtriggers, ObjectIdGetDatum(), OidIsValid, palloc(), palloc0(), pfree(), pstrdup(), RelationData::rd_att, RelationGetRelationName, RelationGetRelid, repalloc(), ScanKeyInit(), SetTriggerFlags(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), TextDatumGetCString, Trigger::tgargs, Trigger::tgattr, Trigger::tgconstraint, Trigger::tgconstrindid, Trigger::tgconstrrelid, Trigger::tgdeferrable, Trigger::tgenabled, Trigger::tgfoid, Trigger::tginitdeferred, Trigger::tgisclone, Trigger::tgisinternal, Trigger::tgname, Trigger::tgnargs, Trigger::tgnattr, Trigger::tgnewtable, Trigger::tgoid, Trigger::tgoldtable, Trigger::tgqual, Trigger::tgtype, RelationData::trigdesc, TriggerDesc::triggers, val, and VARDATA_ANY.
Referenced by RelationBuildDesc(), and RelationCacheInitializePhase3().
void RemoveTriggerById | ( | Oid | trigOid | ) |
Definition at line 1287 of file trigger.c.
References AccessExclusiveLock, allowSystemTableMods, BTEqualStrategyNumber, CacheInvalidateRelcache(), CatalogTupleDelete(), elog, ereport, errcode(), errdetail_relkind_not_supported(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, IsSystemRelation(), NoLock, ObjectIdGetDatum(), RelationData::rd_rel, RelationGetRelationName, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
ObjectAddress renametrig | ( | RenameStmt * | stmt | ) |
Definition at line 1463 of file trigger.c.
References AccessExclusiveLock, BTEqualStrategyNumber, ereport, errcode(), errhint(), errmsg(), ERROR, find_all_inheritors(), get_partition_parent(), get_rel_name(), GETSTRUCT, HeapTupleIsValid, i, sort-test::key, NoLock, PartitionDescData::nparts, ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, PartitionDescData::oids, PointerGetDatum(), RangeVarCallbackForRenameTrigger(), RangeVarGetRelidExtended(), RelationData::rd_rel, relation_close(), relation_open(), RelationGetPartitionDesc(), RelationGetRelationName, renametrig_internal(), renametrig_partition(), RowExclusiveLock, ScanKeyInit(), stmt, systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by ExecRenameStmt().
bool RI_FKey_fk_upd_check_required | ( | Trigger * | trigger, |
Relation | fk_rel, | ||
TupleTableSlot * | oldslot, | ||
TupleTableSlot * | newslot | ||
) |
Definition at line 1328 of file ri_triggers.c.
References Assert, RI_ConstraintInfo::confmatchtype, FKCONSTR_MATCH_FULL, FKCONSTR_MATCH_PARTIAL, FKCONSTR_MATCH_SIMPLE, RelationData::rd_rel, RelationGetDescr, ri_FetchConstraintInfo(), RI_KEYS_ALL_NULL, RI_KEYS_SOME_NULL, ri_KeysEqual(), ri_NullCheck(), and slot_is_current_xact_tuple().
Referenced by AfterTriggerSaveEvent().
bool RI_FKey_pk_upd_check_required | ( | Trigger * | trigger, |
Relation | pk_rel, | ||
TupleTableSlot * | oldslot, | ||
TupleTableSlot * | newslot | ||
) |
Definition at line 1296 of file ri_triggers.c.
References RelationGetDescr, ri_FetchConstraintInfo(), RI_KEYS_NONE_NULL, ri_KeysEqual(), and ri_NullCheck().
Referenced by AfterTriggerSaveEvent().
int RI_FKey_trigger_type | ( | Oid | tgfoid | ) |
Definition at line 3119 of file ri_triggers.c.
References RI_TRIGGER_FK, RI_TRIGGER_NONE, and RI_TRIGGER_PK.
Referenced by AfterTriggerSaveEvent(), ExecCrossPartitionUpdateForeignKey(), GetForeignKeyActionTriggers(), and GetForeignKeyCheckTriggers().
Definition at line 1429 of file ri_triggers.c.