PostgreSQL Source Code
git master
|
#include "catalog/dependency.h"
#include "catalog/objectaddress.h"
#include "catalog/pg_event_trigger.h"
#include "nodes/parsenodes.h"
#include "tcop/cmdtag.h"
#include "tcop/deparse_utility.h"
#include "utils/aclchk_internal.h"
Go to the source code of this file.
Data Structures | |
struct | EventTriggerData |
Macros | |
#define | AT_REWRITE_ALTER_PERSISTENCE 0x01 |
#define | AT_REWRITE_DEFAULT_VAL 0x02 |
#define | AT_REWRITE_COLUMN_REWRITE 0x04 |
#define | AT_REWRITE_ACCESS_METHOD 0x08 |
#define | CALLED_AS_EVENT_TRIGGER(fcinfo) ((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData)) |
Typedefs | |
typedef struct EventTriggerData | EventTriggerData |
Variables | |
PGDLLIMPORT bool | event_triggers |
#define AT_REWRITE_ACCESS_METHOD 0x08 |
Definition at line 43 of file event_trigger.h.
#define AT_REWRITE_ALTER_PERSISTENCE 0x01 |
Definition at line 40 of file event_trigger.h.
#define AT_REWRITE_COLUMN_REWRITE 0x04 |
Definition at line 42 of file event_trigger.h.
#define AT_REWRITE_DEFAULT_VAL 0x02 |
Definition at line 41 of file event_trigger.h.
#define CALLED_AS_EVENT_TRIGGER | ( | fcinfo | ) | ((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData)) |
Definition at line 49 of file event_trigger.h.
typedef struct EventTriggerData EventTriggerData |
Oid AlterEventTrigger | ( | AlterEventTrigStmt * | stmt | ) |
Definition at line 423 of file event_trigger.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, CatalogTupleUpdate(), CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, GETSTRUCT, GetUserId(), heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, namestrcmp(), OBJECT_EVENT_TRIGGER, object_ownercheck(), RowExclusiveLock, SearchSysCacheCopy1, SetDatabaseHasLoginEventTriggers(), stmt, HeapTupleData::t_self, table_close(), table_open(), and TRIGGER_DISABLED.
Referenced by standard_ProcessUtility().
ObjectAddress AlterEventTriggerOwner | ( | const char * | name, |
Oid | newOwnerId | ||
) |
Definition at line 475 of file event_trigger.c.
References AlterEventTriggerOwner_internal(), CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, name, ObjectAddressSet, RowExclusiveLock, SearchSysCacheCopy1, table_close(), and table_open().
Referenced by ExecAlterOwnerStmt().
Definition at line 510 of file event_trigger.c.
References AlterEventTriggerOwner_internal(), ereport, errcode(), errmsg(), ERROR, heap_freetuple(), HeapTupleIsValid, ObjectIdGetDatum(), RowExclusiveLock, SearchSysCacheCopy1, table_close(), and table_open().
Referenced by shdepReassignOwned_Owner().
Oid CreateEventTrigger | ( | CreateEventTrigStmt * | stmt | ) |
Definition at line 120 of file event_trigger.c.
References DefElem::arg, CStringGetDatum(), DefElem::defname, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errhint(), errmsg(), ERROR, error_duplicate_filter_variable(), get_func_rettype(), GetUserId(), HeapTupleIsValid, insert_event_trigger_tuple(), lfirst, LookupFuncName(), NameListToString(), SearchSysCache1(), stmt, superuser(), validate_ddl_tags(), and validate_table_rewrite_tags().
Referenced by standard_ProcessUtility().
void EventTriggerAlterTableEnd | ( | void | ) |
Definition at line 1708 of file event_trigger.c.
References CollectedCommand::alterTable, EventTriggerQueryState::commandCollectionInhibited, EventTriggerQueryState::commandList, EventTriggerQueryState::currentCommand, currentEventTriggerState, EventTriggerQueryState::cxt, CollectedCommand::d, lappend(), MemoryContextSwitchTo(), NIL, CollectedCommand::parent, and pfree().
Referenced by AlterTableMoveAll(), ProcessUtilityForAlterTable(), and ProcessUtilitySlow().
void EventTriggerAlterTableRelid | ( | Oid | objectId | ) |
Definition at line 1655 of file event_trigger.c.
References CollectedCommand::alterTable, EventTriggerQueryState::commandCollectionInhibited, EventTriggerQueryState::currentCommand, currentEventTriggerState, and CollectedCommand::d.
Referenced by AlterTableInternal(), ProcessUtilityForAlterTable(), and ProcessUtilitySlow().
void EventTriggerAlterTableStart | ( | Node * | parsetree | ) |
Definition at line 1621 of file event_trigger.c.
References CollectedCommand::alterTable, EventTriggerQueryState::commandCollectionInhibited, copyObject, creating_extension, EventTriggerQueryState::currentCommand, currentEventTriggerState, EventTriggerQueryState::cxt, CollectedCommand::d, CollectedCommand::in_extension, InvalidOid, MemoryContextSwitchTo(), NIL, palloc(), CollectedCommand::parent, CollectedCommand::parsetree, SCT_AlterTable, and CollectedCommand::type.
Referenced by AlterTableMoveAll(), ProcessUtilityForAlterTable(), and ProcessUtilitySlow().
bool EventTriggerBeginCompleteQuery | ( | void | ) |
Definition at line 1179 of file event_trigger.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, EventTriggerQueryState::commandCollectionInhibited, currentEventTriggerState, InvalidOid, MemoryContextAlloc(), NIL, slist_init(), TopMemoryContext, and trackDroppedObjectsNeeded().
Referenced by ProcessUtilitySlow().
void EventTriggerCollectAlterDefPrivs | ( | AlterDefaultPrivilegesStmt * | stmt | ) |
Definition at line 1892 of file event_trigger.c.
References EventTriggerQueryState::commandCollectionInhibited, EventTriggerQueryState::commandList, copyObject, creating_extension, currentEventTriggerState, EventTriggerQueryState::cxt, CollectedCommand::d, CollectedCommand::defprivs, CollectedCommand::in_extension, lappend(), MemoryContextSwitchTo(), palloc0(), CollectedCommand::parsetree, SCT_AlterDefaultPrivileges, stmt, and CollectedCommand::type.
Referenced by ProcessUtilitySlow().
void EventTriggerCollectAlterOpFam | ( | AlterOpFamilyStmt * | stmt, |
Oid | opfamoid, | ||
List * | operators, | ||
List * | procedures | ||
) |
Definition at line 1790 of file event_trigger.c.
References EventTriggerQueryState::commandCollectionInhibited, EventTriggerQueryState::commandList, copyObject, creating_extension, currentEventTriggerState, EventTriggerQueryState::cxt, CollectedCommand::d, CollectedCommand::in_extension, lappend(), MemoryContextSwitchTo(), ObjectAddressSet, CollectedCommand::opfam, palloc(), CollectedCommand::parsetree, SCT_AlterOpFamily, stmt, and CollectedCommand::type.
Referenced by AlterOpFamilyAdd(), and AlterOpFamilyDrop().
void EventTriggerCollectAlterTableSubcmd | ( | Node * | subcmd, |
ObjectAddress | address | ||
) |
Definition at line 1673 of file event_trigger.c.
References CollectedCommand::alterTable, Assert, EventTriggerQueryState::commandCollectionInhibited, copyObject, EventTriggerQueryState::currentCommand, currentEventTriggerState, EventTriggerQueryState::cxt, CollectedCommand::d, IsA, lappend(), MemoryContextSwitchTo(), newsub(), OidIsValid, and palloc().
Referenced by ATExecCmd().
void EventTriggerCollectAlterTSConfig | ( | AlterTSConfigurationStmt * | stmt, |
Oid | cfgId, | ||
Oid * | dictIds, | ||
int | ndicts | ||
) |
Definition at line 1857 of file event_trigger.c.
References CollectedCommand::atscfg, EventTriggerQueryState::commandCollectionInhibited, EventTriggerQueryState::commandList, copyObject, creating_extension, currentEventTriggerState, EventTriggerQueryState::cxt, CollectedCommand::d, CollectedCommand::in_extension, lappend(), MemoryContextSwitchTo(), ObjectAddressSet, palloc(), palloc0(), CollectedCommand::parsetree, SCT_AlterTSConfig, stmt, and CollectedCommand::type.
Referenced by DropConfigurationMapping(), and MakeConfigurationMapping().
void EventTriggerCollectCreateOpClass | ( | CreateOpClassStmt * | stmt, |
Oid | opcoid, | ||
List * | operators, | ||
List * | procedures | ||
) |
Definition at line 1823 of file event_trigger.c.
References EventTriggerQueryState::commandCollectionInhibited, EventTriggerQueryState::commandList, copyObject, CollectedCommand::createopc, creating_extension, currentEventTriggerState, EventTriggerQueryState::cxt, CollectedCommand::d, CollectedCommand::in_extension, lappend(), MemoryContextSwitchTo(), ObjectAddressSet, palloc0(), CollectedCommand::parsetree, SCT_CreateOpClass, stmt, and CollectedCommand::type.
Referenced by DefineOpClass().
void EventTriggerCollectGrant | ( | InternalGrant * | istmt | ) |
Definition at line 1746 of file event_trigger.c.
References InternalGrant::col_privs, EventTriggerQueryState::commandCollectionInhibited, EventTriggerQueryState::commandList, copyObject, creating_extension, currentEventTriggerState, EventTriggerQueryState::cxt, CollectedCommand::d, CollectedCommand::grant, InternalGrant::grantees, CollectedCommand::in_extension, lappend(), lfirst, list_copy(), MemoryContextSwitchTo(), NIL, InternalGrant::objects, palloc(), CollectedCommand::parsetree, SCT_Grant, and CollectedCommand::type.
Referenced by ExecGrantStmt_oids().
void EventTriggerCollectSimpleCommand | ( | ObjectAddress | address, |
ObjectAddress | secondaryObject, | ||
Node * | parsetree | ||
) |
Definition at line 1583 of file event_trigger.c.
References EventTriggerQueryState::commandCollectionInhibited, EventTriggerQueryState::commandList, copyObject, creating_extension, currentEventTriggerState, EventTriggerQueryState::cxt, CollectedCommand::d, CollectedCommand::in_extension, lappend(), MemoryContextSwitchTo(), palloc(), CollectedCommand::parsetree, SCT_Simple, CollectedCommand::simple, and CollectedCommand::type.
Referenced by AlterPublicationOptions(), CreateOpFamily(), CreateSchemaCommand(), ProcessUtilitySlow(), PublicationAddSchemas(), PublicationAddTables(), reindex_index(), and ReindexRelationConcurrently().
void EventTriggerDDLCommandEnd | ( | Node * | parsetree | ) |
Definition at line 772 of file event_trigger.c.
References CommandCounterIncrement(), currentEventTriggerState, event_triggers, EventTriggerCommonSetup(), EventTriggerInvoke(), EVT_DDLCommandEnd, IsUnderPostmaster, list_free(), and NIL.
Referenced by ProcessUtilitySlow().
void EventTriggerDDLCommandStart | ( | Node * | parsetree | ) |
Definition at line 721 of file event_trigger.c.
References CommandCounterIncrement(), event_triggers, EventTriggerCommonSetup(), EventTriggerInvoke(), EVT_DDLCommandStart, IsUnderPostmaster, list_free(), and NIL.
Referenced by ProcessUtilitySlow().
void EventTriggerEndCompleteQuery | ( | void | ) |
Definition at line 1223 of file event_trigger.c.
References currentEventTriggerState, EventTriggerQueryState::cxt, MemoryContextDelete(), and EventTriggerQueryState::previous.
Referenced by ProcessUtilitySlow().
void EventTriggerInhibitCommandCollection | ( | void | ) |
Definition at line 1549 of file event_trigger.c.
References EventTriggerQueryState::commandCollectionInhibited, and currentEventTriggerState.
Referenced by ProcessUtilitySlow().
void EventTriggerOnLogin | ( | void | ) |
Definition at line 893 of file event_trigger.c.
References AccessExclusiveLock, BTEqualStrategyNumber, CommitTransactionCommand(), ConditionalLockSharedObject(), elog, ERROR, event_triggers, EventTriggerCommonSetup(), EventTriggerInvoke(), EVT_Login, GETSTRUCT, GetTransactionSnapshot(), heap_freetuple(), HeapTupleIsValid, IsUnderPostmaster, sort-test::key, list_free(), MyDatabaseHasLoginEventTriggers, MyDatabaseId, NIL, ObjectIdGetDatum(), OidIsValid, PopActiveSnapshot(), PushActiveSnapshot(), RowExclusiveLock, ScanKeyInit(), StartTransactionCommand(), systable_inplace_update_begin(), systable_inplace_update_cancel(), systable_inplace_update_finish(), table_close(), and table_open().
Referenced by PostgresMain().
void EventTriggerSQLDrop | ( | Node * | parsetree | ) |
Definition at line 820 of file event_trigger.c.
References CommandCounterIncrement(), currentEventTriggerState, event_triggers, EventTriggerCommonSetup(), EventTriggerInvoke(), EVT_SQLDrop, EventTriggerQueryState::in_sql_drop, IsUnderPostmaster, list_free(), NIL, PG_END_TRY, PG_FINALLY, PG_TRY, slist_is_empty(), and EventTriggerQueryState::SQLDropList.
Referenced by ProcessUtilitySlow().
void EventTriggerSQLDropAddObject | ( | const ObjectAddress * | object, |
bool | original, | ||
bool | normal | ||
) |
Definition at line 1273 of file event_trigger.c.
References AccessShareLock, SQLDropObject::addrargs, SQLDropObject::address, SQLDropObject::addrnames, Assert, attnum, ObjectAddress::classId, currentEventTriggerState, EventTriggerQueryState::cxt, DatumGetName(), DatumGetObjectId(), EventTriggerSupportsObject(), get_catalog_object_by_oid(), get_namespace_name(), get_object_attnum_name(), get_object_attnum_namespace(), get_object_attnum_oid(), get_object_namensp_unique(), getObjectIdentityParts(), getObjectTypeDescription(), heap_getattr(), InvalidAttrNumber, is_objectclass_supported(), isAnyTempNamespace(), SQLDropObject::istemp, isTempNamespace(), MemoryContextSwitchTo(), NameStr, SQLDropObject::next, SQLDropObject::normal, ObjectAddress::objectId, ObjectAddress::objectSubId, SQLDropObject::objecttype, SQLDropObject::objidentity, SQLDropObject::objname, SQLDropObject::original, palloc0(), pfree(), pstrdup(), RelationGetDescr, SQLDropObject::schemaname, slist_push_head(), EventTriggerQueryState::SQLDropList, table_close(), and table_open().
Referenced by deleteObjectsInList(), and DropSubscription().
bool EventTriggerSupportsObject | ( | const ObjectAddress * | object | ) |
Definition at line 1153 of file event_trigger.c.
References ObjectAddress::classId.
Referenced by deleteObjectsInList(), and EventTriggerSQLDropAddObject().
bool EventTriggerSupportsObjectType | ( | ObjectType | obtype | ) |
Definition at line 1129 of file event_trigger.c.
References OBJECT_DATABASE, OBJECT_EVENT_TRIGGER, OBJECT_PARAMETER_ACL, OBJECT_ROLE, and OBJECT_TABLESPACE.
Referenced by ExecGrantStmt_oids(), and standard_ProcessUtility().
Definition at line 999 of file event_trigger.c.
References CommandCounterIncrement(), currentEventTriggerState, event_triggers, EventTriggerCommonSetup(), EventTriggerInvoke(), EVT_TableRewrite, InvalidOid, IsUnderPostmaster, list_free(), NIL, PG_END_TRY, PG_FINALLY, PG_TRY, EventTriggerQueryState::table_rewrite_oid, and EventTriggerQueryState::table_rewrite_reason.
Referenced by ATRewriteTables().
void EventTriggerUndoInhibitCommandCollection | ( | void | ) |
Definition at line 1561 of file event_trigger.c.
References EventTriggerQueryState::commandCollectionInhibited, and currentEventTriggerState.
Referenced by ProcessUtilitySlow().
Oid get_event_trigger_oid | ( | const char * | trigname, |
bool | missing_ok | ||
) |
Definition at line 575 of file event_trigger.c.
References CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, GetSysCacheOid1, and OidIsValid.
Referenced by get_object_address_unqualified().
bool trackDroppedObjectsNeeded | ( | void | ) |
Definition at line 1241 of file event_trigger.c.
References EventCacheLookup(), EVT_DDLCommandEnd, EVT_SQLDrop, EVT_TableRewrite, and NIL.
Referenced by deleteObjectsInList(), and EventTriggerBeginCompleteQuery().
|
extern |
Definition at line 84 of file event_trigger.c.
Referenced by EventTriggerDDLCommandEnd(), EventTriggerDDLCommandStart(), EventTriggerOnLogin(), EventTriggerSQLDrop(), and EventTriggerTableRewrite().