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 |
#define AT_REWRITE_ACCESS_METHOD 0x08 |
Definition at line 35 of file event_trigger.h.
#define AT_REWRITE_ALTER_PERSISTENCE 0x01 |
Definition at line 32 of file event_trigger.h.
#define AT_REWRITE_COLUMN_REWRITE 0x04 |
Definition at line 34 of file event_trigger.h.
#define AT_REWRITE_DEFAULT_VAL 0x02 |
Definition at line 33 of file event_trigger.h.
#define CALLED_AS_EVENT_TRIGGER | ( | fcinfo | ) | ((fcinfo)->context != NULL && IsA((fcinfo)->context, EventTriggerData)) |
Definition at line 41 of file event_trigger.h.
typedef struct EventTriggerData EventTriggerData |
Oid AlterEventTrigger | ( | AlterEventTrigStmt * | stmt | ) |
Definition at line 361 of file event_trigger.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, CatalogTupleUpdate(), CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, EVENTTRIGGERNAME, GETSTRUCT, GetUserId(), heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, OBJECT_EVENT_TRIGGER, object_ownercheck(), RowExclusiveLock, SearchSysCacheCopy1, stmt, HeapTupleData::t_self, table_close(), and table_open().
Referenced by standard_ProcessUtility().
ObjectAddress AlterEventTriggerOwner | ( | const char * | name, |
Oid | newOwnerId | ||
) |
Definition at line 405 of file event_trigger.c.
References AlterEventTriggerOwner_internal(), CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, EVENTTRIGGERNAME, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, name, ObjectAddressSet, RowExclusiveLock, SearchSysCacheCopy1, table_close(), and table_open().
Referenced by ExecAlterOwnerStmt().
Definition at line 440 of file event_trigger.c.
References AlterEventTriggerOwner_internal(), ereport, errcode(), errmsg(), ERROR, EVENTTRIGGEROID, heap_freetuple(), HeapTupleIsValid, ObjectIdGetDatum(), RowExclusiveLock, SearchSysCacheCopy1, table_close(), and table_open().
Referenced by shdepReassignOwned().
Oid CreateEventTrigger | ( | CreateEventTrigStmt * | stmt | ) |
Definition at line 108 of file event_trigger.c.
References DefElem::arg, CStringGetDatum(), DefElem::defname, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errhint(), errmsg(), ERROR, error_duplicate_filter_variable(), EVENTTRIGGERNAME, 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 1608 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 1555 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 1521 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 1079 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 1792 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 1690 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 1573 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 1757 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 1723 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 1646 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 1483 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(), and PublicationAddTables().
void EventTriggerDDLCommandEnd | ( | Node * | parsetree | ) |
Definition at line 688 of file event_trigger.c.
References CommandCounterIncrement(), currentEventTriggerState, EventTriggerCommonSetup(), EventTriggerInvoke(), EVT_DDLCommandEnd, IsUnderPostmaster, list_free(), and NIL.
Referenced by ProcessUtilitySlow().
void EventTriggerDDLCommandStart | ( | Node * | parsetree | ) |
Definition at line 640 of file event_trigger.c.
References CommandCounterIncrement(), EventTriggerCommonSetup(), EventTriggerInvoke(), EVT_DDLCommandStart, IsUnderPostmaster, list_free(), and NIL.
Referenced by ProcessUtilitySlow().
void EventTriggerEndCompleteQuery | ( | void | ) |
Definition at line 1123 of file event_trigger.c.
References currentEventTriggerState, EventTriggerQueryState::cxt, MemoryContextDelete(), and EventTriggerQueryState::previous.
Referenced by ProcessUtilitySlow().
void EventTriggerInhibitCommandCollection | ( | void | ) |
Definition at line 1449 of file event_trigger.c.
References EventTriggerQueryState::commandCollectionInhibited, and currentEventTriggerState.
Referenced by ProcessUtilitySlow().
void EventTriggerSQLDrop | ( | Node * | parsetree | ) |
Definition at line 736 of file event_trigger.c.
References CommandCounterIncrement(), currentEventTriggerState, 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 1173 of file event_trigger.c.
References AccessShareLock, SQLDropObject::addrargs, SQLDropObject::address, SQLDropObject::addrnames, Assert(), attnum, ObjectAddress::classId, currentEventTriggerState, EventTriggerQueryState::cxt, DatumGetName(), DatumGetObjectId(), EventTriggerSupportsObjectClass(), get_catalog_object_by_oid(), get_namespace_name(), get_object_attnum_name(), get_object_attnum_namespace(), get_object_attnum_oid(), get_object_namensp_unique(), getObjectClass(), 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 EventTriggerSupportsObjectClass | ( | ObjectClass | objclass | ) |
Definition at line 1011 of file event_trigger.c.
References OCLASS_AM, OCLASS_AMOP, OCLASS_AMPROC, OCLASS_CAST, OCLASS_CLASS, OCLASS_COLLATION, OCLASS_CONSTRAINT, OCLASS_CONVERSION, OCLASS_DATABASE, OCLASS_DEFACL, OCLASS_DEFAULT, OCLASS_EVENT_TRIGGER, OCLASS_EXTENSION, OCLASS_FDW, OCLASS_FOREIGN_SERVER, OCLASS_LANGUAGE, OCLASS_LARGEOBJECT, OCLASS_OPCLASS, OCLASS_OPERATOR, OCLASS_OPFAMILY, OCLASS_PARAMETER_ACL, OCLASS_POLICY, OCLASS_PROC, OCLASS_PUBLICATION, OCLASS_PUBLICATION_NAMESPACE, OCLASS_PUBLICATION_REL, OCLASS_REWRITE, OCLASS_ROLE, OCLASS_ROLE_MEMBERSHIP, OCLASS_SCHEMA, OCLASS_STATISTIC_EXT, OCLASS_SUBSCRIPTION, OCLASS_TBLSPACE, OCLASS_TRANSFORM, OCLASS_TRIGGER, OCLASS_TSCONFIG, OCLASS_TSDICT, OCLASS_TSPARSER, OCLASS_TSTEMPLATE, OCLASS_TYPE, and OCLASS_USER_MAPPING.
Referenced by deleteObjectsInList(), and EventTriggerSQLDropAddObject().
bool EventTriggerSupportsObjectType | ( | ObjectType | obtype | ) |
Definition at line 935 of file event_trigger.c.
References OBJECT_ACCESS_METHOD, OBJECT_AGGREGATE, OBJECT_AMOP, OBJECT_AMPROC, OBJECT_ATTRIBUTE, OBJECT_CAST, OBJECT_COLLATION, OBJECT_COLUMN, OBJECT_CONVERSION, OBJECT_DATABASE, OBJECT_DEFACL, OBJECT_DEFAULT, OBJECT_DOMAIN, OBJECT_DOMCONSTRAINT, OBJECT_EVENT_TRIGGER, OBJECT_EXTENSION, OBJECT_FDW, OBJECT_FOREIGN_SERVER, OBJECT_FOREIGN_TABLE, OBJECT_FUNCTION, OBJECT_INDEX, OBJECT_LANGUAGE, OBJECT_LARGEOBJECT, OBJECT_MATVIEW, OBJECT_OPCLASS, OBJECT_OPERATOR, OBJECT_OPFAMILY, OBJECT_PARAMETER_ACL, OBJECT_POLICY, OBJECT_PROCEDURE, OBJECT_PUBLICATION, OBJECT_PUBLICATION_NAMESPACE, OBJECT_PUBLICATION_REL, OBJECT_ROLE, OBJECT_ROUTINE, OBJECT_RULE, OBJECT_SCHEMA, OBJECT_SEQUENCE, OBJECT_STATISTIC_EXT, OBJECT_SUBSCRIPTION, OBJECT_TABCONSTRAINT, OBJECT_TABLE, OBJECT_TABLESPACE, OBJECT_TRANSFORM, OBJECT_TRIGGER, OBJECT_TSCONFIGURATION, OBJECT_TSDICTIONARY, OBJECT_TSPARSER, OBJECT_TSTEMPLATE, OBJECT_TYPE, OBJECT_USER_MAPPING, and OBJECT_VIEW.
Referenced by ExecGrantStmt_oids(), and standard_ProcessUtility().
Definition at line 807 of file event_trigger.c.
References CommandCounterIncrement(), currentEventTriggerState, 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 1461 of file event_trigger.c.
References EventTriggerQueryState::commandCollectionInhibited, and currentEventTriggerState.
Referenced by ProcessUtilitySlow().
Definition at line 505 of file event_trigger.c.
References CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, EVENTTRIGGERNAME, GetSysCacheOid1, and OidIsValid.
Referenced by get_object_address_unqualified().
bool trackDroppedObjectsNeeded | ( | void | ) |
Definition at line 1141 of file event_trigger.c.
References EventCacheLookup(), EVT_DDLCommandEnd, EVT_SQLDrop, EVT_TableRewrite, and NIL.
Referenced by deleteObjectsInList(), and EventTriggerBeginCompleteQuery().