PostgreSQL Source Code git master
|
#include "access/htup.h"
#include "nodes/parsenodes.h"
#include "storage/lockdefs.h"
#include "utils/relcache.h"
Go to the source code of this file.
Data Structures | |
struct | ObjectAddress |
Macros | |
#define | ObjectAddressSubSet(addr, class_id, object_id, object_sub_id) |
#define | ObjectAddressSet(addr, class_id, object_id) ObjectAddressSubSet(addr, class_id, object_id, 0) |
Typedefs | |
typedef struct ObjectAddress | ObjectAddress |
Variables | |
PGDLLIMPORT const ObjectAddress | InvalidObjectAddress |
#define ObjectAddressSet | ( | addr, | |
class_id, | |||
object_id | |||
) | ObjectAddressSubSet(addr, class_id, object_id, 0) |
Definition at line 40 of file objectaddress.h.
#define ObjectAddressSubSet | ( | addr, | |
class_id, | |||
object_id, | |||
object_sub_id | |||
) |
Definition at line 33 of file objectaddress.h.
typedef struct ObjectAddress ObjectAddress |
void check_object_ownership | ( | Oid | roleid, |
ObjectType | objtype, | ||
ObjectAddress | address, | ||
Node * | object, | ||
Relation | relation | ||
) |
Definition at line 2387 of file objectaddress.c.
References aclcheck_error(), aclcheck_error_type(), ACLCHECK_NOT_OWNER, castNode, ObjectAddress::classId, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, format_type_be(), GETSTRUCT(), GetUserNameFromId(), has_createrole_privilege(), HeapTupleIsValid, is_admin_of_role(), linitial_node, lo_compat_privileges, lsecond_node, NameListToString(), 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_ownercheck(), 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, OBJECT_VIEW, ObjectAddress::objectId, ObjectIdGetDatum(), RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), SearchSysCache1(), strVal, superuser_arg(), and typenameTypeId().
Referenced by CommentObject(), ExecAlterExtensionContentsStmt(), ExecAlterObjectDependsStmt(), ExecSecLabelStmt(), and RemoveObjects().
HeapTuple get_catalog_object_by_oid | ( | Relation | catalog, |
AttrNumber | oidcol, | ||
Oid | objectId | ||
) |
Definition at line 2786 of file objectaddress.c.
References get_catalog_object_by_oid_extended().
Referenced by EventTriggerSQLDropAddObject(), getConstraintTypeDescription(), getObjectIdentityParts(), pg_event_trigger_ddl_commands(), pg_get_acl(), and pg_identify_object().
HeapTuple get_catalog_object_by_oid_extended | ( | Relation | catalog, |
AttrNumber | oidcol, | ||
Oid | objectId, | ||
bool | locktup | ||
) |
Definition at line 2799 of file objectaddress.c.
References Assert, BTEqualStrategyNumber, get_object_catcache_oid(), get_object_oid_index(), heap_copytuple(), HeapTupleIsValid, InplaceUpdateTupleLock, LockTuple(), ObjectIdGetDatum(), OidIsValid, RelationGetRelid, ScanKeyInit(), SearchSysCacheCopy1, SearchSysCacheLockedCopy1(), systable_beginscan(), systable_endscan(), systable_getnext(), and HeapTupleData::t_self.
Referenced by AlterObjectOwner_internal(), and get_catalog_object_by_oid().
ObjectAddress get_object_address | ( | ObjectType | objtype, |
Node * | object, | ||
Relation * | relp, | ||
LOCKMODE | lockmode, | ||
bool | missing_ok | ||
) |
Definition at line 923 of file objectaddress.c.
References Assert, castNode, ObjectAddress::classId, elog, ereport, errcode(), errmsg(), ERROR, get_cast_oid(), get_collation_oid(), get_conversion_oid(), get_domain_constraint_oid(), get_language_oid(), get_object_address_attrdef(), get_object_address_attribute(), get_object_address_defacl(), get_object_address_opcf(), get_object_address_opf_member(), get_object_address_publication_rel(), get_object_address_publication_schema(), get_object_address_relobject(), get_object_address_type(), get_object_address_unqualified(), get_object_address_usermapping(), get_relation_by_qualified_name(), get_statistics_object_oid(), get_transform_oid(), get_ts_config_oid(), get_ts_dict_oid(), get_ts_parser_oid(), get_ts_template_oid(), InvalidOid, IsSharedRelation(), LargeObjectExists(), linitial_node, LockDatabaseObject(), LockSharedObject(), LookupFuncWithArgs(), LookupOperWithArgs(), LookupTypeNameOid(), lsecond, lsecond_node, NoLock, 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, OBJECT_VIEW, ObjectAddress::objectId, ObjectAddress::objectSubId, OidIsValid, oidparse(), SharedInvalidMessageCounter, strVal, UnlockDatabaseObject(), and UnlockSharedObject().
Referenced by CommentObject(), ExecAlterExtensionContentsStmt(), ExecAlterObjectDependsStmt(), ExecAlterObjectSchemaStmt(), ExecAlterOwnerStmt(), ExecRenameStmt(), ExecSecLabelStmt(), get_object_address_rv(), objectNamesToOids(), pg_get_object_address(), and RemoveObjects().
ObjectAddress get_object_address_rv | ( | ObjectType | objtype, |
RangeVar * | rel, | ||
List * | object, | ||
Relation * | relp, | ||
LOCKMODE | lockmode, | ||
bool | missing_ok | ||
) |
Definition at line 1225 of file objectaddress.c.
References RangeVar::catalogname, get_object_address(), lcons(), makeString(), RangeVar::relname, and RangeVar::schemaname.
Referenced by ExecAlterObjectDependsStmt().
AttrNumber get_object_attnum_acl | ( | Oid | class_id | ) |
Definition at line 2689 of file objectaddress.c.
References ObjectPropertyType::attnum_acl, and get_object_property_data().
Referenced by AlterObjectOwner_internal(), ExecGrant_common(), object_aclmask_ext(), pg_get_acl(), and recordExtObjInitPriv().
AttrNumber get_object_attnum_name | ( | Oid | class_id | ) |
Definition at line 2665 of file objectaddress.c.
References ObjectPropertyType::attnum_name, and get_object_property_data().
Referenced by AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), EventTriggerSQLDropAddObject(), ExecGrant_common(), and pg_identify_object().
AttrNumber get_object_attnum_namespace | ( | Oid | class_id | ) |
Definition at line 2673 of file objectaddress.c.
References ObjectPropertyType::attnum_namespace, and get_object_property_data().
Referenced by AlterObjectNamespace_internal(), AlterObjectNamespace_oid(), AlterObjectOwner_internal(), AlterObjectRename_internal(), EventTriggerSQLDropAddObject(), pg_event_trigger_ddl_commands(), and pg_identify_object().
AttrNumber get_object_attnum_oid | ( | Oid | class_id | ) |
Definition at line 2657 of file objectaddress.c.
References ObjectPropertyType::attnum_oid, and get_object_property_data().
Referenced by AlterObjectOwner_internal(), DropObjectById(), EventTriggerSQLDropAddObject(), object_ownercheck(), pg_event_trigger_ddl_commands(), pg_get_acl(), and pg_identify_object().
AttrNumber get_object_attnum_owner | ( | Oid | class_id | ) |
Definition at line 2681 of file objectaddress.c.
References ObjectPropertyType::attnum_owner, and get_object_property_data().
Referenced by AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), ExecGrant_common(), object_aclmask_ext(), object_ownercheck(), and RemoveRoleFromInitPriv().
int get_object_catcache_name | ( | Oid | class_id | ) |
Definition at line 2649 of file objectaddress.c.
References get_object_property_data(), and ObjectPropertyType::name_catcache_id.
Referenced by AlterObjectNamespace_internal(), and AlterObjectRename_internal().
int get_object_catcache_oid | ( | Oid | class_id | ) |
Definition at line 2641 of file objectaddress.c.
References get_object_property_data(), and ObjectPropertyType::oid_catcache_id.
Referenced by AlterObjectNamespace_internal(), AlterObjectRename_internal(), DropObjectById(), ExecGrant_common(), get_catalog_object_by_oid_extended(), object_aclmask_ext(), object_ownercheck(), recordExtObjInitPriv(), and RemoveRoleFromInitPriv().
const char * get_object_class_descr | ( | Oid | class_id | ) |
Definition at line 2625 of file objectaddress.c.
References ObjectPropertyType::class_descr, and get_object_property_data().
Referenced by DropObjectById(), ExecGrant_common(), object_aclmask_ext(), object_ownercheck(), recordExtObjInitPriv(), and RemoveRoleFromInitPriv().
bool get_object_namensp_unique | ( | Oid | class_id | ) |
Definition at line 2722 of file objectaddress.c.
References get_object_property_data(), and ObjectPropertyType::is_nsp_name_unique.
Referenced by EventTriggerSQLDropAddObject(), and pg_identify_object().
Oid get_object_namespace | ( | const ObjectAddress * | address | ) |
Definition at line 2569 of file objectaddress.c.
References Assert, ObjectPropertyType::attnum_namespace, ObjectAddress::classId, DatumGetObjectId(), elog, ERROR, get_object_property_data(), HeapTupleIsValid, InvalidAttrNumber, InvalidOid, ObjectAddress::objectId, ObjectIdGetDatum(), ReleaseSysCache(), SearchSysCache1(), and SysCacheGetAttrNotNull().
Referenced by RemoveObjects().
Definition at line 2633 of file objectaddress.c.
References get_object_property_data(), and ObjectPropertyType::oid_index_oid.
Referenced by DropObjectById(), get_catalog_object_by_oid_extended(), and object_ownercheck().
ObjectType get_object_type | ( | Oid | class_id, |
Oid | object_id | ||
) |
Definition at line 2704 of file objectaddress.c.
References get_object_property_data(), get_rel_relkind(), get_relkind_objtype(), OBJECT_TABLE, and ObjectPropertyType::objtype.
Referenced by AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), ExecGrant_common(), and object_aclmask_ext().
ObjectType get_relkind_objtype | ( | char | relkind | ) |
Definition at line 6172 of file objectaddress.c.
References OBJECT_FOREIGN_TABLE, OBJECT_INDEX, OBJECT_MATVIEW, OBJECT_SEQUENCE, OBJECT_TABLE, and OBJECT_VIEW.
Referenced by AlterTableMoveAll(), ATExecChangeOwner(), ATSimplePermissions(), checkFkeyPermissions(), CreateStatistics(), CreateTriggerFiringOn(), currtid_internal(), DefineQueryRewrite(), EnableDisableRule(), ExecCheckPermissions(), get_object_type(), get_rel_from_relname(), heap_force_common(), LockViewRecurse_walker(), LogicalRepSyncTableStart(), MergeAttributes(), pg_prewarm(), pgrowlocks(), PublicationAddTables(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForDropRelation(), RangeVarCallbackForLockTable(), RangeVarCallbackForPolicy(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackMaintainsTable(), RangeVarCallbackOwnsRelation(), RangeVarGetAndCheckCreationNamespace(), renameatt_check(), stats_lock_check_privileges(), TargetPrivilegesCheck(), transformTableLikeClause(), and truncate_check_perms().
char * getObjectDescription | ( | const ObjectAddress * | object, |
bool | missing_ok | ||
) |
Definition at line 2908 of file objectaddress.c.
References _, AccessShareLock, appendStringInfo(), Assert, attname, BTEqualStrategyNumber, ObjectAddress::classId, CollationIsVisible(), ConversionIsVisible(), StringInfoData::data, datname, elog, ERROR, ForeignDataWrapper::fdwname, format_operator(), format_operator_extended(), FORMAT_OPERATOR_INVALID_AS_NULL, FORMAT_PROC_INVALID_AS_NULL, format_procedure(), format_procedure_extended(), FORMAT_TYPE_ALLOW_INVALID, format_type_be(), format_type_extended(), FORMAT_TYPE_INVALID_AS_NULL, get_attname(), get_database_name(), get_extension_name(), get_language_name(), get_namespace_name(), get_publication_name(), get_subscription_name(), get_tablespace_name(), GetAttrDefaultColumnAddress(), GetForeignDataWrapperExtended(), GetForeignServer(), GetForeignServerExtended(), getObjectDescription(), getOpFamilyDescription(), getPublicationSchemaInfo(), getRelationDescription(), GETSTRUCT(), GetUserNameFromId(), HeapTupleIsValid, initStringInfo(), LargeObjectExists(), StringInfoData::len, NameStr, ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, OidIsValid, OpclassIsVisible(), pfree(), proname, quote_qualified_identifier(), ReleaseSysCache(), ScanKeyInit(), SearchSysCache1(), ForeignServer::servername, StatisticsObjIsVisible(), subname, SysCacheGetAttrNotNull(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), TextDatumGetCString, TSConfigIsVisible(), TSDictionaryIsVisible(), TSParserIsVisible(), TSTemplateIsVisible(), typname, and username.
Referenced by AlterExtensionNamespace(), ATExecAlterColumnType(), changeDependenciesOn(), check_relation_privileges(), checkMembershipInCurrentExtension(), checkSharedDependencies(), ExecAlterExtensionContentsRecurse(), findDependentObjects(), get_altertable_subcmdinfo(), get_object_address_opf_member(), getObjectDescription(), getObjectDescriptionOids(), pg_describe_object(), recordDependencyOnCurrentExtension(), RememberAllDependentForRebuilding(), reportDependentObjects(), sepgsql_fmgr_hook(), shdepDropOwned(), shdepReassignOwned(), and storeObjectDescription().
Definition at line 4076 of file objectaddress.c.
References ObjectAddress::classId, getObjectDescription(), ObjectAddress::objectId, and ObjectAddress::objectSubId.
Referenced by AlterObjectNamespace_internal(), and AlterObjectRename_internal().
char * getObjectIdentity | ( | const ObjectAddress * | object, |
bool | missing_ok | ||
) |
Definition at line 4814 of file objectaddress.c.
References getObjectIdentityParts().
Referenced by check_relation_privileges(), check_schema_perms(), pg_event_trigger_ddl_commands(), pg_identify_object(), sepgsql_attribute_drop(), sepgsql_attribute_post_create(), sepgsql_attribute_relabel(), sepgsql_attribute_setattr(), sepgsql_database_drop(), sepgsql_database_relabel(), sepgsql_database_setattr(), sepgsql_proc_drop(), sepgsql_proc_execute(), sepgsql_proc_post_create(), sepgsql_proc_relabel(), sepgsql_proc_setattr(), sepgsql_relation_drop(), sepgsql_relation_post_create(), sepgsql_relation_relabel(), sepgsql_relation_setattr(), sepgsql_relation_truncate(), sepgsql_schema_drop(), and sepgsql_schema_relabel().
char * getObjectIdentityParts | ( | const ObjectAddress * | object, |
List ** | objname, | ||
List ** | objargs, | ||
bool | missing_ok | ||
) |
Definition at line 4829 of file objectaddress.c.
References _, AccessShareLock, appendStringInfo(), appendStringInfoString(), Assert, BTEqualStrategyNumber, ObjectAddress::classId, StringInfoData::data, datname, elog, ERROR, ForeignDataWrapper::fdwname, format_operator_extended(), FORMAT_OPERATOR_FORCE_QUALIFY, FORMAT_OPERATOR_INVALID_AS_NULL, format_operator_parts(), FORMAT_PROC_FORCE_QUALIFY, FORMAT_PROC_INVALID_AS_NULL, format_procedure_extended(), format_procedure_parts(), format_type_be_qualified(), format_type_extended(), FORMAT_TYPE_FORCE_QUALIFY, FORMAT_TYPE_INVALID_AS_NULL, get_am_name(), get_attname(), get_catalog_object_by_oid(), get_database_name(), get_extension_name(), get_language_name(), get_namespace_name_or_temp(), get_publication_name(), get_subscription_name(), get_tablespace_name(), GetAttrDefaultColumnAddress(), GetForeignDataWrapperExtended(), GetForeignServer(), GetForeignServerExtended(), getObjectIdentityParts(), getOpFamilyIdentity(), getPublicationSchemaInfo(), getRelationIdentity(), GETSTRUCT(), GetUserNameFromId(), HeapTupleIsValid, initStringInfo(), lappend(), LargeObjectExists(), StringInfoData::len, list_make1, list_make2, list_make3, NameStr, NIL, ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, OidIsValid, pfree(), PointerIsValid, proname, psprintf(), pstrdup(), quote_identifier(), quote_qualified_identifier(), ReleaseSysCache(), ScanKeyInit(), SearchSysCache1(), ForeignServer::servername, subname, SysCacheGetAttrNotNull(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), TextDatumGetCString, and username.
Referenced by EventTriggerSQLDropAddObject(), getObjectIdentity(), getObjectIdentityParts(), and pg_identify_object_as_address().
char * getObjectTypeDescription | ( | const ObjectAddress * | object, |
bool | missing_ok | ||
) |
Definition at line 4487 of file objectaddress.c.
References appendStringInfoString(), Assert, ObjectAddress::classId, StringInfoData::data, elog, ERROR, getConstraintTypeDescription(), getProcedureTypeDescription(), getRelationTypeDescription(), initStringInfo(), StringInfoData::len, ObjectAddress::objectId, and ObjectAddress::objectSubId.
Referenced by EventTriggerSQLDropAddObject(), pg_event_trigger_ddl_commands(), pg_identify_object(), pg_identify_object_as_address(), and sepgsql_object_relabel().
bool is_objectclass_supported | ( | Oid | class_id | ) |
Definition at line 2734 of file objectaddress.c.
References lengthof, and ObjectProperty.
Referenced by EventTriggerSQLDropAddObject(), pg_event_trigger_ddl_commands(), and pg_identify_object().
int read_objtype_from_string | ( | const char * | objtype | ) |
Definition at line 2605 of file objectaddress.c.
References ereport, errcode(), errmsg(), ERROR, i, lengthof, and ObjectTypeMap.
Referenced by pg_get_object_address().
Definition at line 6117 of file objectaddress.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, construct_md_array(), CStringGetTextDatum, CurrentMemoryContext, j, lfirst, sort-test::list, list_length(), MemoryContextDelete(), MemoryContextSwitchTo(), name, and palloc().
Referenced by fill_hba_line(), pg_event_trigger_dropped_objects(), and pg_identify_object_as_address().
|
extern |
Definition at line 837 of file objectaddress.c.
Referenced by AlterDomainAddConstraint(), AlterDomainNotNull(), AlterExtensionNamespace(), AlterPublicationOptions(), AlterSequence(), AlterStatistics(), AlterTableNamespace(), ATAddCheckNNConstraint(), ATExecAddColumn(), ATExecAddConstraint(), ATExecAlterColumnGenericOptions(), ATExecAlterConstraint(), ATExecCmd(), ATExecDropColumn(), ATExecDropExpression(), ATExecDropIdentity(), ATExecDropNotNull(), ATExecSetIdentity(), ATExecSetNotNull(), ATExecValidateConstraint(), CommentObject(), CreateExtension(), CreateForeignServer(), CreateOpFamily(), CreateSchemaCommand(), CreateStatistics(), CreateUserMapping(), DefineCollation(), DefineSequence(), ExecAlterExtensionStmt(), ExecAlterObjectSchemaStmt(), ExecAlterOwnerStmt(), ExecCreateTableAs(), ExecRenameStmt(), GetAttrDefaultColumnAddress(), ProcessUtilitySlow(), publication_add_relation(), publication_add_schema(), PublicationAddSchemas(), PublicationAddTables(), reindex_index(), ReindexRelationConcurrently(), renameatt(), RenameConstraint(), and RenameRelation().