|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/htup_details.h"#include "access/sysattr.h"#include "access/table.h"#include "access/tableam.h"#include "access/xact.h"#include "catalog/pg_collation.h"#include "catalog/pg_constraint.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/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 | RI_QueryKey |
| struct | RI_QueryHashEntry |
| struct | RI_CompareKey |
| struct | RI_CompareHashEntry |
Variables | |
| static HTAB * | ri_constraint_cache = NULL |
| static HTAB * | ri_query_cache = NULL |
| static HTAB * | ri_compare_cache = NULL |
| static dclist_head | ri_constraint_cache_valid_list |
| #define MAX_QUOTED_NAME_LEN (NAMEDATALEN*2+3) |
Definition at line 83 of file ri_triggers.c.
| #define MAX_QUOTED_REL_NAME_LEN (MAX_QUOTED_NAME_LEN*2) |
Definition at line 84 of file ri_triggers.c.
| #define RI_INIT_CONSTRAINTHASHSIZE 64 |
Definition at line 60 of file ri_triggers.c.
| #define RI_INIT_QUERYHASHSIZE (RI_INIT_CONSTRAINTHASHSIZE * 4) |
Definition at line 61 of file ri_triggers.c.
| #define RI_KEYS_ALL_NULL 0 |
Definition at line 63 of file ri_triggers.c.
| #define RI_KEYS_NONE_NULL 2 |
Definition at line 65 of file ri_triggers.c.
| #define RI_KEYS_SOME_NULL 1 |
Definition at line 64 of file ri_triggers.c.
| #define RI_MAX_NUMKEYS INDEX_MAX_KEYS |
Definition at line 58 of file ri_triggers.c.
| #define RI_PLAN_CASCADE_ONDELETE 3 |
Definition at line 73 of file ri_triggers.c.
| #define RI_PLAN_CASCADE_ONUPDATE 4 |
Definition at line 74 of file ri_triggers.c.
| #define RI_PLAN_CHECK_LOOKUPPK 1 |
Definition at line 69 of file ri_triggers.c.
| #define RI_PLAN_CHECK_LOOKUPPK_FROM_PK 2 |
Definition at line 70 of file ri_triggers.c.
| #define RI_PLAN_LAST_ON_PK RI_PLAN_CHECK_LOOKUPPK_FROM_PK |
Definition at line 71 of file ri_triggers.c.
| #define RI_PLAN_NO_ACTION 5 |
Definition at line 75 of file ri_triggers.c.
| #define RI_PLAN_RESTRICT 6 |
Definition at line 77 of file ri_triggers.c.
| #define RI_PLAN_SETDEFAULT_ONDELETE 9 |
Definition at line 80 of file ri_triggers.c.
| #define RI_PLAN_SETDEFAULT_ONUPDATE 10 |
Definition at line 81 of file ri_triggers.c.
| #define RI_PLAN_SETNULL_ONDELETE 7 |
Definition at line 78 of file ri_triggers.c.
| #define RI_PLAN_SETNULL_ONUPDATE 8 |
Definition at line 79 of file ri_triggers.c.
| #define RI_TRIGTYPE_DELETE 3 |
Definition at line 92 of file ri_triggers.c.
| #define RI_TRIGTYPE_INSERT 1 |
Definition at line 90 of file ri_triggers.c.
| #define RI_TRIGTYPE_UPDATE 2 |
Definition at line 91 of file ri_triggers.c.
| #define RIAttCollation | ( | rel, | |
| attnum | |||
| ) | attnumCollationId(rel, attnum) |
Definition at line 88 of file ri_triggers.c.
| #define RIAttName | ( | rel, | |
| attnum | |||
| ) | NameStr(*attnumAttName(rel, attnum)) |
Definition at line 86 of file ri_triggers.c.
| #define RIAttType | ( | rel, | |
| attnum | |||
| ) | attnumTypeId(rel, attnum) |
Definition at line 87 of file ri_triggers.c.
Definition at line 2366 of file ri_triggers.c.
References elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), and SearchSysCache1().
Referenced by ri_LoadConstraintInfo().
Definition at line 2400 of file ri_triggers.c.
References Assert, dlist_mutable_iter::cur, dclist_container, dclist_count(), dclist_delete_from(), dclist_foreach_modify, fb(), ri_constraint_cache, and ri_constraint_cache_valid_list.
Referenced by ri_InitHashTables().
Definition at line 2031 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 2051 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 2136 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 511 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(), RelationGetDescr, 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 2168 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 3071 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 2622 of file ri_triggers.c.
References fb(), i, and slot_getattr().
Referenced by ri_PerformCheck().
|
static |
Definition at line 2214 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 2896 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 915 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 1017 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 250 of file ri_triggers.c.
References 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(), RelationGetDescr, RelationGetRelationName, ri_BuildQueryKey(), 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 474 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 490 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 1418 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 639 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 676 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 1386 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 659 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 696 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 1164 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 1179 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 1134 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 1149 of file ri_triggers.c.
References ri_CheckTrigger(), ri_set(), and RI_TRIGTYPE_UPDATE.
Definition at line 3210 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 2068 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 2095 of file ri_triggers.c.
References appendStringInfo(), buf, elog, ERROR, fb(), 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 3117 of file ri_triggers.c.
References Assert, 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().
|
static |
Definition at line 2948 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 2860 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 1519 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, NameStr, NewGUCNestLevel(), NIL, object_ownercheck(), PGC_S_SESSION, PGC_USERSET, quoteOneName(), quoteRelationName(), 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 2985 of file ri_triggers.c.
References 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 2268 of file ri_triggers.c.
References Assert, dclist_push_tail(), DeconstructFkConstraintRow(), elog, ERROR, fb(), FindFKPeriodOpers(), get_index_column_opclass(), get_ri_constraint_root(), GETSTRUCT(), GetSysCacheHashValue1, HASH_ENTER, hash_search(), HeapTupleIsValid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), ri_constraint_cache, ri_constraint_cache_valid_list, ri_InitHashTables(), and SearchSysCache1().
Referenced by ri_FetchConstraintInfo().
|
static |
Definition at line 2823 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 1813 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, 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 2484 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 2441 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 2651 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(), RelationGetRelationName, RI_PLAN_CHECK_LOOKUPPK, RLS_ENABLED, slot_getattr(), TupleDescAttr(), and val.
Referenced by RI_Initial_Check(), RI_PartitionRemove_Check(), and ri_PerformCheck().
|
static |
Definition at line 712 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(), 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 1195 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 185 of file ri_triggers.c.
Referenced by ri_HashCompareOp(), and ri_InitHashTables().
Definition at line 183 of file ri_triggers.c.
Referenced by InvalidateConstraintCacheCallBack(), ri_InitHashTables(), and ri_LoadConstraintInfo().
|
static |
Definition at line 186 of file ri_triggers.c.
Referenced by InvalidateConstraintCacheCallBack(), and ri_LoadConstraintInfo().
Definition at line 184 of file ri_triggers.c.
Referenced by ri_FetchPreparedPlan(), ri_HashPreparedPlan(), and ri_InitHashTables().