|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/amapi.h"#include "access/genam.h"#include "access/htup_details.h"#include "access/skey.h"#include "access/sysattr.h"#include "access/table.h"#include "access/tableam.h"#include "access/xact.h"#include "catalog/index.h"#include "catalog/pg_collation.h"#include "catalog/pg_constraint.h"#include "catalog/pg_namespace.h"#include "commands/trigger.h"#include "executor/executor.h"#include "executor/spi.h"#include "lib/ilist.h"#include "miscadmin.h"#include "parser/parse_coerce.h"#include "parser/parse_relation.h"#include "utils/acl.h"#include "utils/builtins.h"#include "utils/datum.h"#include "utils/fmgroids.h"#include "utils/guc.h"#include "utils/hsearch.h"#include "utils/inval.h"#include "utils/lsyscache.h"#include "utils/memutils.h"#include "utils/rel.h"#include "utils/rls.h"#include "utils/ruleutils.h"#include "utils/snapmgr.h"#include "utils/syscache.h"
Go to the source code of this file.
Data Structures | |
| struct | RI_ConstraintInfo |
| struct | FastPathMeta |
| struct | RI_QueryKey |
| struct | RI_QueryHashEntry |
| struct | RI_CompareKey |
| struct | RI_CompareHashEntry |
| struct | RI_FastPathEntry |
Typedefs | |
| typedef struct FastPathMeta | FastPathMeta |
| typedef struct RI_ConstraintInfo | RI_ConstraintInfo |
| typedef struct RI_CompareHashEntry | RI_CompareHashEntry |
| typedef struct RI_QueryKey | RI_QueryKey |
| typedef struct RI_QueryHashEntry | RI_QueryHashEntry |
| typedef struct RI_CompareKey | RI_CompareKey |
| typedef struct RI_FastPathEntry | RI_FastPathEntry |
| #define MAX_QUOTED_NAME_LEN (NAMEDATALEN*2+3) |
Definition at line 89 of file ri_triggers.c.
| #define MAX_QUOTED_REL_NAME_LEN (MAX_QUOTED_NAME_LEN*2) |
Definition at line 90 of file ri_triggers.c.
| #define RI_FASTPATH_BATCH_SIZE 64 |
Definition at line 213 of file ri_triggers.c.
| #define RI_INIT_CONSTRAINTHASHSIZE 64 |
Definition at line 66 of file ri_triggers.c.
| #define RI_INIT_QUERYHASHSIZE (RI_INIT_CONSTRAINTHASHSIZE * 4) |
Definition at line 67 of file ri_triggers.c.
| #define RI_KEYS_ALL_NULL 0 |
Definition at line 69 of file ri_triggers.c.
| #define RI_KEYS_NONE_NULL 2 |
Definition at line 71 of file ri_triggers.c.
| #define RI_KEYS_SOME_NULL 1 |
Definition at line 70 of file ri_triggers.c.
| #define RI_MAX_NUMKEYS INDEX_MAX_KEYS |
Definition at line 64 of file ri_triggers.c.
| #define RI_PLAN_CASCADE_ONDELETE 3 |
Definition at line 79 of file ri_triggers.c.
| #define RI_PLAN_CASCADE_ONUPDATE 4 |
Definition at line 80 of file ri_triggers.c.
| #define RI_PLAN_CHECK_LOOKUPPK 1 |
Definition at line 75 of file ri_triggers.c.
| #define RI_PLAN_CHECK_LOOKUPPK_FROM_PK 2 |
Definition at line 76 of file ri_triggers.c.
| #define RI_PLAN_LAST_ON_PK RI_PLAN_CHECK_LOOKUPPK_FROM_PK |
Definition at line 77 of file ri_triggers.c.
| #define RI_PLAN_NO_ACTION 5 |
Definition at line 81 of file ri_triggers.c.
| #define RI_PLAN_RESTRICT 6 |
Definition at line 83 of file ri_triggers.c.
| #define RI_PLAN_SETDEFAULT_ONDELETE 9 |
Definition at line 86 of file ri_triggers.c.
| #define RI_PLAN_SETDEFAULT_ONUPDATE 10 |
Definition at line 87 of file ri_triggers.c.
| #define RI_PLAN_SETNULL_ONDELETE 7 |
Definition at line 84 of file ri_triggers.c.
| #define RI_PLAN_SETNULL_ONUPDATE 8 |
Definition at line 85 of file ri_triggers.c.
| #define RI_TRIGTYPE_DELETE 3 |
Definition at line 98 of file ri_triggers.c.
| #define RI_TRIGTYPE_INSERT 1 |
Definition at line 96 of file ri_triggers.c.
| #define RI_TRIGTYPE_UPDATE 2 |
Definition at line 97 of file ri_triggers.c.
| #define RIAttCollation | ( | rel, | |
| attnum | |||
| ) | attnumCollationId(rel, attnum) |
Definition at line 94 of file ri_triggers.c.
| #define RIAttName | ( | rel, | |
| attnum | |||
| ) | NameStr(*attnumAttName(rel, attnum)) |
Definition at line 92 of file ri_triggers.c.
| #define RIAttType | ( | rel, | |
| attnum | |||
| ) | attnumTypeId(rel, attnum) |
Definition at line 93 of file ri_triggers.c.
| typedef struct FastPathMeta FastPathMeta |
Definition at line 100 of file ri_triggers.c.
Definition at line 149 of file ri_triggers.c.
| typedef struct RI_CompareKey RI_CompareKey |
| typedef struct RI_QueryKey RI_QueryKey |
|
static |
Definition at line 3393 of file ri_triggers.c.
References Assert, BoolGetDatum(), FastPathMeta::cast_func_finfo, fb(), FmgrInfo::fn_oid, FunctionCall3, i, Int32GetDatum(), OidIsValid, RelationData::rd_indcollation, FastPathMeta::regops, ScanKeyEntryInitialize(), FastPathMeta::strats, and FastPathMeta::subtypes.
Referenced by ri_FastPathCheck(), and ri_FastPathFlushLoop().
Definition at line 2503 of file ri_triggers.c.
References elog, ERROR, fb(), Form_pg_constraint, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), and SearchSysCache1().
Referenced by ri_LoadConstraintInfo().
|
static |
Definition at line 2537 of file ri_triggers.c.
References Assert, dlist_mutable_iter::cur, dclist_container, dclist_count(), dclist_delete_from(), dclist_foreach_modify, fb(), pfree(), ri_constraint_cache, and ri_constraint_cache_valid_list.
Referenced by ri_InitHashTables().
Definition at line 2161 of file ri_triggers.c.
References name.
Referenced by quoteRelationName(), ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), ri_GenerateQualCollation(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_restrict(), and ri_set().
Definition at line 2181 of file ri_triggers.c.
References fb(), get_namespace_name(), quoteOneName(), RelationGetNamespace, and RelationGetRelationName.
Referenced by ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_restrict(), and ri_set().
|
static |
Definition at line 3343 of file ri_triggers.c.
References Assert, BuildIndexInfo(), DatumGetBool(), fb(), FormIndexDatum(), FunctionCall2Coll(), i, IndexInfo::ii_ExclusionOps, IndexInfo::ii_Expressions, IndexInfo::ii_NumIndexKeyAttrs, INDEX_MAX_KEYS, NIL, and values.
Referenced by ri_FastPathFlushArray(), and ri_FastPathProbeOne().
|
static |
Definition at line 2266 of file ri_triggers.c.
References fb(), and RI_PLAN_CHECK_LOOKUPPK_FROM_PK.
Referenced by ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), ri_restrict(), and ri_set().
|
static |
Definition at line 641 of file ri_triggers.c.
References appendStringInfo(), appendStringInfoString(), Assert, attname, elog, ERROR, fb(), i, initStringInfo(), MAX_QUOTED_NAME_LEN, MAX_QUOTED_REL_NAME_LEN, quoteOneName(), quoteRelationName(), RelationData::rd_rel, RelationGetDescr, result, ri_BuildQueryKey(), ri_FetchPreparedPlan(), ri_GenerateQual(), RI_KEYS_NONE_NULL, RI_MAX_NUMKEYS, ri_NullCheck(), ri_PerformCheck(), RI_PLAN_CHECK_LOOKUPPK_FROM_PK, ri_PlanCheck(), RIAttName, RIAttType, SPI_connect(), SPI_finish(), SPI_OK_FINISH, SPI_OK_SELECT, and sprintf.
Referenced by ri_restrict().
Definition at line 3312 of file ri_triggers.c.
References ACL_SELECT, ACL_USAGE, aclcheck_error(), ACLCHECK_OK, fb(), get_namespace_name(), GetUserId(), object_aclcheck(), OBJECT_SCHEMA, OBJECT_TABLE, pg_class_aclcheck(), RelationGetNamespace, RelationGetRelationName, and RelationGetRelid.
Referenced by ri_FastPathBatchFlush(), and ri_FastPathCheck().
Definition at line 2298 of file ri_triggers.c.
References CALLED_AS_TRIGGER, FunctionCallInfoBaseData::context, ereport, errcode(), errmsg, ERROR, fb(), funcname, RI_TRIGTYPE_DELETE, RI_TRIGTYPE_INSERT, RI_TRIGTYPE_UPDATE, TriggerData::tg_event, TRIGGER_FIRED_AFTER, TRIGGER_FIRED_BY_DELETE, TRIGGER_FIRED_BY_INSERT, TRIGGER_FIRED_BY_UPDATE, and TRIGGER_FIRED_FOR_ROW.
Referenced by RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check_ins(), RI_FKey_check_upd(), RI_FKey_noaction_del(), RI_FKey_noaction_upd(), RI_FKey_restrict_del(), RI_FKey_restrict_upd(), RI_FKey_setdefault_del(), RI_FKey_setdefault_upd(), RI_FKey_setnull_del(), and RI_FKey_setnull_upd().
Definition at line 3926 of file ri_triggers.c.
References BoolGetDatum(), RI_CompareHashEntry::cast_func_finfo, collid, DatumGetBool(), RI_CompareHashEntry::eq_opr_finfo, fb(), FmgrInfo::fn_oid, FunctionCall2Coll(), FunctionCall3, Int32GetDatum(), OidIsValid, and ri_HashCompareOp().
Referenced by ri_KeysEqual().
|
static |
Definition at line 3477 of file ri_triggers.c.
References fb(), i, and slot_getattr().
Referenced by ri_FastPathCheck(), ri_FastPathFlushArray(), ri_FastPathFlushLoop(), and ri_PerformCheck().
|
static |
Definition at line 3285 of file ri_triggers.c.
References fb().
Referenced by RI_FKey_check().
|
static |
Definition at line 2859 of file ri_triggers.c.
References ExecCopySlotHeapTuple(), fb(), MemoryContextSwitchTo(), RI_FASTPATH_BATCH_SIZE, ri_FastPathBatchFlush(), and ri_FastPathGetEntry().
Referenced by RI_FKey_check().
|
static |
Definition at line 2885 of file ri_triggers.c.
References Assert, CommandCounterIncrement(), ExecStoreHeapTuple(), fb(), GetTransactionSnapshot(), GetUserIdAndSecContext(), index_beginscan(), index_endscan(), MemoryContextReset(), MemoryContextSwitchTo(), RegisterSnapshot(), RelationGetForm, ri_CheckPermissions(), ri_FastPathFlushArray(), ri_FastPathFlushLoop(), ri_LoadConstraintInfo(), RI_PLAN_CHECK_LOOKUPPK, ri_populate_fastpath_metadata(), ri_ReportViolation(), SECURITY_LOCAL_USERID_CHANGE, SECURITY_NOFORCE_RLS, SetUserIdAndSecContext(), SO_NONE, and UnregisterSnapshot().
Referenced by ri_FastPathBatchAdd(), and ri_FastPathEndBatch().
|
static |
Definition at line 2779 of file ri_triggers.c.
References AccessShareLock, Assert, build_index_scankeys(), CommandCounterIncrement(), ExecDropSingleTupleTableSlot(), fb(), GetTransactionSnapshot(), GetUserIdAndSecContext(), index_beginscan(), index_close(), index_endscan(), INDEX_MAX_KEYS, index_open(), NoLock, RegisterSnapshot(), RelationGetForm, ri_CheckPermissions(), ri_ExtractValues(), ri_FastPathProbeOne(), ri_LoadConstraintInfo(), RI_PLAN_CHECK_LOOKUPPK, ri_populate_fastpath_metadata(), ri_ReportViolation(), RowShareLock, SECURITY_LOCAL_USERID_CHANGE, SECURITY_NOFORCE_RLS, SetUserIdAndSecContext(), SO_NONE, table_close(), table_open(), table_slot_create(), and UnregisterSnapshot().
Referenced by RI_FKey_check().
Definition at line 4109 of file ri_triggers.c.
References AccessShareLock, RI_FastPathEntry::batch_count, RI_FastPathEntry::conoid, fb(), RI_FastPathEntry::fk_relid, hash_seq_init(), hash_seq_search(), NoLock, ri_fastpath_cache, ri_FastPathBatchFlush(), ri_FastPathTeardown(), ri_LoadConstraintInfo(), table_close(), and table_open().
Referenced by ri_FastPathGetEntry().
|
static |
Definition at line 3031 of file ri_triggers.c.
References IndexAmRoutine::amsearcharray, Assert, BoolGetDatum(), FastPathMeta::cast_func_finfo, construct_array(), DatumGetBool(), FastPathMeta::eq_opr_finfo, ExecStoreHeapTuple(), fb(), FmgrInfo::fn_oid, ForwardScanDirection, FunctionCall2Coll(), FunctionCall3, get_typlenbyvalalign(), i, index_getnext_slot(), INDEX_MAX_KEYS, index_rescan(), Int32GetDatum(), OidIsValid, PointerGetDatum(), RelationData::rd_indam, RelationData::rd_indcollation, recheck_matched_pk_tuple(), FastPathMeta::regops, ri_ExtractValues(), RI_FASTPATH_BATCH_SIZE, ri_LockPKTuple(), ScanKeyEntryInitialize(), SK_SEARCHARRAY, slot_getattr(), FastPathMeta::strats, and FastPathMeta::subtypes.
Referenced by ri_FastPathBatchFlush().
|
static |
Definition at line 2987 of file ri_triggers.c.
References build_index_scankeys(), ExecStoreHeapTuple(), fb(), i, INDEX_MAX_KEYS, ri_ExtractValues(), and ri_FastPathProbeOne().
Referenced by ri_FastPathBatchFlush().
|
static |
Definition at line 4210 of file ri_triggers.c.
References AccessShareLock, ALLOCSET_SMALL_SIZES, AllocSetContextCreate, ctl, fb(), HASH_BLOBS, HASH_CONTEXT, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), index_open(), MakeSingleTupleTableSlot(), MemoryContextSwitchTo(), RegisterAfterTriggerBatchCallback(), RegisterSubXactCallback(), RegisterXactCallback(), RelationGetDescr, RelationGetRelid, ri_fastpath_cache, ri_fastpath_callback_registered, ri_fastpath_xact_callback_registered, ri_FastPathEndBatch(), ri_FastPathSubXactCallback(), ri_FastPathXactCallback(), RowShareLock, table_open(), table_slot_create(), TopTransactionContext, and TTSOpsHeapTuple.
Referenced by ri_FastPathBatchAdd().
|
static |
Definition at line 3179 of file ri_triggers.c.
References fb(), ForwardScanDirection, index_getnext_slot(), index_rescan(), recheck_matched_pk_tuple(), and ri_LockPKTuple().
Referenced by ri_FastPathCheck(), and ri_FastPathFlushLoop().
|
static |
Definition at line 4184 of file ri_triggers.c.
References fb(), ri_fastpath_cache, ri_fastpath_callback_registered, and SUBXACT_EVENT_ABORT_SUB.
Referenced by ri_FastPathGetEntry().
Definition at line 4141 of file ri_triggers.c.
References ExecDropSingleTupleTableSlot(), fb(), RI_FastPathEntry::fk_slot, RI_FastPathEntry::flush_cxt, hash_destroy(), hash_seq_init(), hash_seq_search(), RI_FastPathEntry::idx_rel, index_close(), MemoryContextDelete(), NoLock, RI_FastPathEntry::pk_rel, RI_FastPathEntry::pk_slot, ri_fastpath_cache, ri_fastpath_callback_registered, and table_close().
Referenced by ri_FastPathEndBatch().
Definition at line 4172 of file ri_triggers.c.
References fb(), ri_fastpath_cache, and ri_fastpath_callback_registered.
Referenced by ri_FastPathGetEntry().
|
static |
Definition at line 2344 of file ri_triggers.c.
References elog, ereport, errcode(), errhint(), errmsg, ERROR, fb(), FKCONSTR_MATCH_FULL, FKCONSTR_MATCH_PARTIAL, FKCONSTR_MATCH_SIMPLE, OidIsValid, RelationGetRelationName, RelationGetRelid, and ri_LoadConstraintInfo().
Referenced by RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), RI_FKey_fk_upd_check_required(), RI_FKey_pk_upd_check_required(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_restrict(), and ri_set().
|
static |
Definition at line 3751 of file ri_triggers.c.
References fb(), HASH_FIND, hash_search(), RI_QueryHashEntry::plan, plan, ri_InitHashTables(), ri_query_cache, SPI_freeplan(), and SPI_plan_is_valid().
Referenced by ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), ri_restrict(), and ri_set().
| Datum RI_FKey_cascade_del | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1045 of file ri_triggers.c.
References appendStringInfo(), attname, elog, ERROR, fb(), i, initStringInfo(), MAX_QUOTED_NAME_LEN, MAX_QUOTED_REL_NAME_LEN, PointerGetDatum(), quoteOneName(), quoteRelationName(), ri_BuildQueryKey(), ri_CheckTrigger(), ri_FetchConstraintInfo(), ri_FetchPreparedPlan(), ri_GenerateQual(), RI_MAX_NUMKEYS, ri_PerformCheck(), RI_PLAN_CASCADE_ONDELETE, ri_PlanCheck(), RI_TRIGTYPE_DELETE, RIAttName, RIAttType, RowExclusiveLock, SPI_connect(), SPI_finish(), SPI_OK_DELETE, SPI_OK_FINISH, sprintf, table_close(), table_open(), TriggerData::tg_relation, TriggerData::tg_trigger, and TriggerData::tg_trigslot.
| Datum RI_FKey_cascade_upd | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1147 of file ri_triggers.c.
References appendBinaryStringInfo(), appendStringInfo(), attname, elog, ERROR, fb(), i, initStringInfo(), j, MAX_QUOTED_NAME_LEN, MAX_QUOTED_REL_NAME_LEN, PointerGetDatum(), quoteOneName(), quoteRelationName(), ri_BuildQueryKey(), ri_CheckTrigger(), ri_FetchConstraintInfo(), ri_FetchPreparedPlan(), ri_GenerateQual(), RI_MAX_NUMKEYS, ri_PerformCheck(), RI_PLAN_CASCADE_ONUPDATE, ri_PlanCheck(), RI_TRIGTYPE_UPDATE, RIAttName, RIAttType, RowExclusiveLock, SPI_connect(), SPI_finish(), SPI_OK_FINISH, SPI_OK_UPDATE, sprintf, table_close(), table_open(), TriggerData::tg_newslot, TriggerData::tg_relation, TriggerData::tg_trigger, and TriggerData::tg_trigslot.
|
static |
Definition at line 357 of file ri_triggers.c.
References AfterTriggerIsActive(), appendStringInfo(), appendStringInfoString(), attname, elog, ereport, errcode(), errdetail(), errmsg, ERROR, errtableconstraint(), fb(), FKCONSTR_MATCH_FULL, FKCONSTR_MATCH_PARTIAL, FKCONSTR_MATCH_SIMPLE, i, initStringInfo(), MAX_QUOTED_NAME_LEN, MAX_QUOTED_REL_NAME_LEN, NameStr, PointerGetDatum(), quoteOneName(), quoteRelationName(), RelationData::rd_rel, RelationGetDescr, RelationGetRelationName, ri_BuildQueryKey(), ri_fastpath_is_applicable(), ri_FastPathBatchAdd(), ri_FastPathCheck(), ri_FetchConstraintInfo(), ri_FetchPreparedPlan(), ri_GenerateQual(), RI_KEYS_ALL_NULL, RI_KEYS_NONE_NULL, RI_KEYS_SOME_NULL, RI_MAX_NUMKEYS, ri_NullCheck(), ri_PerformCheck(), RI_PLAN_CHECK_LOOKUPPK, ri_PlanCheck(), RIAttName, RIAttType, RowShareLock, SnapshotSelf, SPI_connect(), SPI_finish(), SPI_OK_FINISH, SPI_OK_SELECT, sprintf, table_close(), table_open(), table_tuple_satisfies_snapshot(), TriggerData::tg_event, TriggerData::tg_newslot, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigslot, and TRIGGER_FIRED_BY_UPDATE.
Referenced by RI_FKey_check_ins(), and RI_FKey_check_upd().
| Datum RI_FKey_check_ins | ( | PG_FUNCTION_ARGS | ) |
Definition at line 604 of file ri_triggers.c.
References ri_CheckTrigger(), RI_FKey_check(), and RI_TRIGTYPE_INSERT.
Referenced by validateForeignKeyConstraint().
| Datum RI_FKey_check_upd | ( | PG_FUNCTION_ARGS | ) |
Definition at line 620 of file ri_triggers.c.
References ri_CheckTrigger(), RI_FKey_check(), and RI_TRIGTYPE_UPDATE.
| bool RI_FKey_fk_upd_check_required | ( | Trigger * | trigger, |
| Relation | fk_rel, | ||
| TupleTableSlot * | oldslot, | ||
| TupleTableSlot * | newslot | ||
| ) |
Definition at line 1548 of file ri_triggers.c.
References Assert, fb(), FKCONSTR_MATCH_FULL, FKCONSTR_MATCH_PARTIAL, FKCONSTR_MATCH_SIMPLE, RelationGetDescr, ri_FetchConstraintInfo(), RI_KEYS_ALL_NULL, RI_KEYS_SOME_NULL, ri_KeysEqual(), ri_NullCheck(), and slot_is_current_xact_tuple().
Referenced by AfterTriggerSaveEvent().
| Datum RI_FKey_noaction_del | ( | PG_FUNCTION_ARGS | ) |
Definition at line 769 of file ri_triggers.c.
References ri_CheckTrigger(), ri_restrict(), and RI_TRIGTYPE_DELETE.
| Datum RI_FKey_noaction_upd | ( | PG_FUNCTION_ARGS | ) |
Definition at line 806 of file ri_triggers.c.
References ri_CheckTrigger(), ri_restrict(), and RI_TRIGTYPE_UPDATE.
| bool RI_FKey_pk_upd_check_required | ( | Trigger * | trigger, |
| Relation | pk_rel, | ||
| TupleTableSlot * | oldslot, | ||
| TupleTableSlot * | newslot | ||
| ) |
Definition at line 1516 of file ri_triggers.c.
References fb(), RelationGetDescr, ri_FetchConstraintInfo(), RI_KEYS_NONE_NULL, ri_KeysEqual(), and ri_NullCheck().
Referenced by AfterTriggerSaveEvent().
| Datum RI_FKey_restrict_del | ( | PG_FUNCTION_ARGS | ) |
Definition at line 789 of file ri_triggers.c.
References ri_CheckTrigger(), ri_restrict(), and RI_TRIGTYPE_DELETE.
| Datum RI_FKey_restrict_upd | ( | PG_FUNCTION_ARGS | ) |
Definition at line 826 of file ri_triggers.c.
References ri_CheckTrigger(), ri_restrict(), and RI_TRIGTYPE_UPDATE.
| Datum RI_FKey_setdefault_del | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1294 of file ri_triggers.c.
References ri_CheckTrigger(), ri_set(), and RI_TRIGTYPE_DELETE.
| Datum RI_FKey_setdefault_upd | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1309 of file ri_triggers.c.
References ri_CheckTrigger(), ri_set(), and RI_TRIGTYPE_UPDATE.
| Datum RI_FKey_setnull_del | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1264 of file ri_triggers.c.
References ri_CheckTrigger(), ri_set(), and RI_TRIGTYPE_DELETE.
| Datum RI_FKey_setnull_upd | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1279 of file ri_triggers.c.
References ri_CheckTrigger(), ri_set(), and RI_TRIGTYPE_UPDATE.
Definition at line 4074 of file ri_triggers.c.
References fb(), RI_TRIGGER_FK, RI_TRIGGER_NONE, and RI_TRIGGER_PK.
Referenced by AfterTriggerSaveEvent(), ExecCrossPartitionUpdateForeignKey(), GetForeignKeyActionTriggers(), and GetForeignKeyCheckTriggers().
|
static |
Definition at line 2198 of file ri_triggers.c.
References appendStringInfo(), buf, fb(), and generate_operator_clause().
Referenced by ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), RI_Initial_Check(), RI_PartitionRemove_Check(), ri_restrict(), and ri_set().
|
static |
Definition at line 2225 of file ri_triggers.c.
References appendStringInfo(), buf, elog, ERROR, fb(), Form_pg_collation, get_namespace_name(), GETSTRUCT(), HeapTupleIsValid, MAX_QUOTED_NAME_LEN, NameStr, ObjectIdGetDatum(), OidIsValid, quoteOneName(), ReleaseSysCache(), and SearchSysCache1().
Referenced by RI_Initial_Check(), and RI_PartitionRemove_Check().
|
static |
Definition at line 3975 of file ri_triggers.c.
References RI_CompareHashEntry::cast_func_finfo, COERCION_IMPLICIT, COERCION_PATH_FUNC, COERCION_PATH_RELABELTYPE, elog, RI_CompareHashEntry::eq_opr_finfo, ERROR, find_coercion_pathway(), fmgr_info_cxt(), FmgrInfo::fn_oid, format_type_be(), get_opcode(), HASH_ENTER, hash_search(), InvalidOid, IsBinaryCoercible(), OidIsValid, op_input_types(), ri_compare_cache, ri_InitHashTables(), TopMemoryContext, and RI_CompareHashEntry::valid.
Referenced by ri_CompareWithCast(), and ri_populate_fastpath_metadata().
|
static |
Definition at line 3803 of file ri_triggers.c.
References Assert, fb(), HASH_ENTER, hash_search(), RI_QueryHashEntry::plan, plan, ri_InitHashTables(), and ri_query_cache.
Referenced by ri_PlanCheck().
Definition at line 3715 of file ri_triggers.c.
References CacheRegisterSyscacheCallback(), ctl, fb(), HASH_BLOBS, hash_create(), HASH_ELEM, InvalidateConstraintCacheCallBack(), HASHCTL::keysize, ri_compare_cache, ri_constraint_cache, RI_INIT_CONSTRAINTHASHSIZE, RI_INIT_QUERYHASHSIZE, and ri_query_cache.
Referenced by ri_FetchPreparedPlan(), ri_HashCompareOp(), ri_HashPreparedPlan(), and ri_LoadConstraintInfo().
Definition at line 1649 of file ri_triggers.c.
References AccessShareLock, ACL_SELECT, appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), AtEOXact_GUC(), bms_add_member(), elog, ereport, errcode(), errdetail(), errmsg, ERROR, errtableconstraint(), ExecCheckPermissions(), ExecDropSingleTupleTableSlot(), ExecStoreVirtualTuple(), fb(), FirstLowInvalidHeapAttributeNumber, FKCONSTR_MATCH_FULL, FKCONSTR_MATCH_SIMPLE, GetLatestSnapshot(), GetUserId(), GUC_ACTION_SAVE, has_bypassrls_privilege(), heap_deform_tuple(), i, initStringInfo(), InvalidSnapshot, lappend(), list_length(), maintenance_work_mem, makeNode, MakeSingleTupleTableSlot(), MAX_QUOTED_NAME_LEN, MAX_QUOTED_REL_NAME_LEN, memcpy(), NameStr, NewGUCNestLevel(), NIL, object_ownercheck(), PGC_S_SESSION, PGC_USERSET, quoteOneName(), quoteRelationName(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, ri_FetchConstraintInfo(), ri_GenerateQual(), ri_GenerateQualCollation(), RI_KEYS_NONE_NULL, ri_NullCheck(), RI_PLAN_CHECK_LOOKUPPK, ri_ReportViolation(), RIAttCollation, RIAttName, RIAttType, RTE_RELATION, set_config_option(), snprintf, SPI_connect(), SPI_execute_snapshot(), SPI_finish(), SPI_OK_FINISH, SPI_OK_SELECT, SPI_prepare(), SPI_processed, SPI_result, SPI_result_code_string(), SPI_tuptable, TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, TTSOpsVirtual, SPITupleTable::tupdesc, and SPITupleTable::vals.
Referenced by validateForeignKeyConstraint().
|
static |
Definition at line 3840 of file ri_triggers.c.
References CompactAttribute::attbyval, CompactAttribute::attlen, datum_image_eq(), fb(), i, ri_CompareWithCast(), RIAttCollation, RIAttType, slot_getattr(), and TupleDescCompactAttr().
Referenced by RI_FKey_fk_upd_check_required(), and RI_FKey_pk_upd_check_required().
|
static |
Definition at line 2398 of file ri_triggers.c.
References Assert, dclist_push_tail(), DeconstructFkConstraintRow(), elog, ERROR, fb(), FindFKPeriodOpers(), Form_pg_constraint, get_index_column_opclass(), get_rel_relkind(), get_ri_constraint_root(), GETSTRUCT(), GetSysCacheHashValue1, HASH_ENTER, hash_search(), HeapTupleIsValid, memcpy(), ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), ri_constraint_cache, ri_constraint_cache_valid_list, ri_InitHashTables(), and SearchSysCache1().
Referenced by ri_FastPathBatchFlush(), ri_FastPathCheck(), ri_FastPathEndBatch(), and ri_FetchConstraintInfo().
|
static |
Definition at line 3217 of file ri_triggers.c.
References elog, ereport, errcode(), ERRCODE_T_R_SERIALIZATION_FAILURE, errmsg, ERROR, fb(), GetCurrentCommandId(), IsolationUsesXactSnapshot, LockTupleKeyShare, LockWaitBlock, result, table_tuple_lock(), TM_Deleted, TM_Invisible, TM_Ok, TM_SelfModified, TM_Updated, TM_FailureData::traversed, TupleTableSlot::tts_tid, TUPLE_LOCK_FLAG_FIND_LAST_VERSION, and TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS.
Referenced by ri_FastPathFlushArray(), and ri_FastPathProbeOne().
|
static |
Definition at line 3678 of file ri_triggers.c.
References fb(), i, RI_KEYS_ALL_NULL, RI_KEYS_NONE_NULL, RI_KEYS_SOME_NULL, and slot_attisnull().
Referenced by ri_Check_Pk_Match(), RI_FKey_check(), RI_FKey_fk_upd_check_required(), RI_FKey_pk_upd_check_required(), and RI_Initial_Check().
Definition at line 1943 of file ri_triggers.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), AtEOXact_GUC(), elog, ERROR, ExecStoreVirtualTuple(), fb(), FKCONSTR_MATCH_FULL, FKCONSTR_MATCH_SIMPLE, GetLatestSnapshot(), GUC_ACTION_SAVE, heap_deform_tuple(), i, initStringInfo(), InvalidSnapshot, maintenance_work_mem, MakeSingleTupleTableSlot(), MAX_QUOTED_NAME_LEN, MAX_QUOTED_REL_NAME_LEN, memcpy(), NewGUCNestLevel(), pg_get_partconstrdef_string(), PGC_S_SESSION, PGC_USERSET, quoteOneName(), quoteRelationName(), RelationGetRelid, ri_FetchConstraintInfo(), ri_GenerateQual(), ri_GenerateQualCollation(), ri_ReportViolation(), RIAttCollation, RIAttName, RIAttType, set_config_option(), snprintf, SPI_connect(), SPI_execute_snapshot(), SPI_finish(), SPI_OK_FINISH, SPI_OK_SELECT, SPI_prepare(), SPI_processed, SPI_result, SPI_result_code_string(), SPI_tuptable, TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, TTSOpsVirtual, SPITupleTable::tupdesc, and SPITupleTable::vals.
Referenced by ATDetachCheckNoForeignKeyRefs().
|
static |
Definition at line 2627 of file ri_triggers.c.
References CommandCounterIncrement(), elog, ereport, errcode(), errhint(), errmsg, ERROR, fb(), GetLatestSnapshot(), GetTransactionSnapshot(), GetUserIdAndSecContext(), InvalidSnapshot, IsolationUsesXactSnapshot, NameStr, RelationGetForm, RelationGetRelationName, ri_ExtractValues(), RI_MAX_NUMKEYS, RI_PLAN_CHECK_LOOKUPPK, RI_PLAN_CHECK_LOOKUPPK_FROM_PK, RI_PLAN_LAST_ON_PK, ri_ReportViolation(), SECURITY_LOCAL_USERID_CHANGE, SECURITY_NOFORCE_RLS, SetUserIdAndSecContext(), SPI_execute_snapshot(), SPI_OK_SELECT, SPI_processed, and SPI_result_code_string().
Referenced by ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), ri_restrict(), and ri_set().
|
static |
Definition at line 2584 of file ri_triggers.c.
References elog, ERROR, fb(), GetUserIdAndSecContext(), RelationGetForm, ri_HashPreparedPlan(), RI_PLAN_LAST_ON_PK, SECURITY_LOCAL_USERID_CHANGE, SECURITY_NOFORCE_RLS, SetUserIdAndSecContext(), SPI_keepplan(), SPI_prepare(), SPI_result, and SPI_result_code_string().
Referenced by ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), ri_restrict(), and ri_set().
|
static |
Definition at line 3439 of file ri_triggers.c.
References Assert, FastPathMeta::cast_func_finfo, RI_CompareHashEntry::cast_func_finfo, CurrentMemoryContext, FastPathMeta::eq_opr_finfo, RI_CompareHashEntry::eq_opr_finfo, fb(), fmgr_info_copy(), get_op_opfamily_properties(), get_opcode(), i, MemoryContextSwitchTo(), palloc_object, RelationData::rd_opfamily, FastPathMeta::regops, ri_HashCompareOp(), RIAttType, FastPathMeta::strats, FastPathMeta::subtypes, and TopMemoryContext.
Referenced by ri_FastPathBatchFlush(), and ri_FastPathCheck().
|
static |
Definition at line 3506 of file ri_triggers.c.
References ACL_SELECT, ACLCHECK_OK, appendStringInfoString(), check_enable_rls(), ereport, errcode(), errdetail(), errmsg, ERROR, errtableconstraint(), fb(), getTypeOutputInfo(), GetUserId(), idx(), initStringInfo(), InvalidOid, name, NameStr, OidOutputFunctionCall(), pg_attribute_aclcheck(), pg_class_aclcheck(), RelationData::rd_att, RelationData::rd_id, RelationGetRelationName, RI_PLAN_CHECK_LOOKUPPK, RLS_ENABLED, slot_getattr(), TupleDescAttr(), and val.
Referenced by ri_FastPathBatchFlush(), ri_FastPathCheck(), RI_Initial_Check(), RI_PartitionRemove_Check(), and ri_PerformCheck().
|
static |
Definition at line 842 of file ri_triggers.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), attname, elog, ERROR, fb(), i, initStringInfo(), MAX_QUOTED_NAME_LEN, MAX_QUOTED_REL_NAME_LEN, PointerGetDatum(), quoteOneName(), quoteRelationName(), RelationData::rd_rel, ri_BuildQueryKey(), ri_Check_Pk_Match(), ri_FetchConstraintInfo(), ri_FetchPreparedPlan(), ri_GenerateQual(), RI_MAX_NUMKEYS, ri_PerformCheck(), RI_PLAN_NO_ACTION, RI_PLAN_RESTRICT, ri_PlanCheck(), RIAttName, RIAttType, RowShareLock, SPI_connect(), SPI_finish(), SPI_OK_FINISH, SPI_OK_SELECT, sprintf, table_close(), table_open(), TriggerData::tg_relation, TriggerData::tg_trigger, and TriggerData::tg_trigslot.
Referenced by RI_FKey_noaction_del(), RI_FKey_noaction_upd(), RI_FKey_restrict_del(), RI_FKey_restrict_upd(), and ri_set().
|
static |
Definition at line 1325 of file ri_triggers.c.
References appendStringInfo(), attname, elog, ERROR, fb(), i, initStringInfo(), MAX_QUOTED_NAME_LEN, MAX_QUOTED_REL_NAME_LEN, PointerGetDatum(), quoteOneName(), quoteRelationName(), ri_BuildQueryKey(), ri_FetchConstraintInfo(), ri_FetchPreparedPlan(), ri_GenerateQual(), RI_MAX_NUMKEYS, ri_PerformCheck(), RI_PLAN_SETDEFAULT_ONDELETE, RI_PLAN_SETDEFAULT_ONUPDATE, RI_PLAN_SETNULL_ONDELETE, RI_PLAN_SETNULL_ONUPDATE, ri_PlanCheck(), ri_restrict(), RI_TRIGTYPE_DELETE, RI_TRIGTYPE_UPDATE, RIAttName, RIAttType, RowExclusiveLock, SPI_connect(), SPI_finish(), SPI_OK_FINISH, SPI_OK_UPDATE, sprintf, table_close(), table_open(), TriggerData::tg_relation, TriggerData::tg_trigger, and TriggerData::tg_trigslot.
Referenced by RI_FKey_setdefault_del(), RI_FKey_setdefault_upd(), RI_FKey_setnull_del(), and RI_FKey_setnull_upd().
Definition at line 258 of file ri_triggers.c.
Referenced by ri_HashCompareOp(), and ri_InitHashTables().
Definition at line 256 of file ri_triggers.c.
Referenced by InvalidateConstraintCacheCallBack(), ri_InitHashTables(), and ri_LoadConstraintInfo().
|
static |
Definition at line 259 of file ri_triggers.c.
Referenced by InvalidateConstraintCacheCallBack(), and ri_LoadConstraintInfo().
Definition at line 261 of file ri_triggers.c.
Referenced by ri_FastPathEndBatch(), ri_FastPathGetEntry(), ri_FastPathSubXactCallback(), ri_FastPathTeardown(), and ri_FastPathXactCallback().
Definition at line 262 of file ri_triggers.c.
Referenced by ri_FastPathGetEntry(), ri_FastPathSubXactCallback(), ri_FastPathTeardown(), and ri_FastPathXactCallback().
Definition at line 4169 of file ri_triggers.c.
Referenced by ri_FastPathGetEntry().
Definition at line 257 of file ri_triggers.c.
Referenced by ri_FetchPreparedPlan(), ri_HashPreparedPlan(), and ri_InitHashTables().