PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
objectaddress.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * objectaddress.h
4  * functions for working with object addresses
5  *
6  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/catalog/objectaddress.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef OBJECTADDRESS_H
14 #define OBJECTADDRESS_H
15 
16 #include "nodes/pg_list.h"
17 #include "storage/lockdefs.h"
18 #include "utils/acl.h"
19 #include "utils/relcache.h"
20 
21 /*
22  * An ObjectAddress represents a database object of any type.
23  */
24 typedef struct ObjectAddress
25 {
26  Oid classId; /* Class Id from pg_class */
27  Oid objectId; /* OID of the object */
28  int32 objectSubId; /* Subitem within object (eg column), or 0 */
30 
32 
33 #define ObjectAddressSubSet(addr, class_id, object_id, object_sub_id) \
34  do { \
35  (addr).classId = (class_id); \
36  (addr).objectId = (object_id); \
37  (addr).objectSubId = (object_sub_id); \
38  } while (0)
39 
40 #define ObjectAddressSet(addr, class_id, object_id) \
41  ObjectAddressSubSet(addr, class_id, object_id, 0)
42 
43 extern ObjectAddress get_object_address(ObjectType objtype, List *objname,
44  List *objargs, Relation *relp,
45  LOCKMODE lockmode, bool missing_ok);
46 
48  List *objname, List *objargs, Relation *relp,
49  LOCKMODE lockmode, bool missing_ok);
50 
51 extern void check_object_ownership(Oid roleid,
52  ObjectType objtype, ObjectAddress address,
53  List *objname, List *objargs, Relation relation);
54 
55 extern Oid get_object_namespace(const ObjectAddress *address);
56 
57 extern bool is_objectclass_supported(Oid class_id);
58 extern Oid get_object_oid_index(Oid class_id);
59 extern int get_object_catcache_oid(Oid class_id);
60 extern int get_object_catcache_name(Oid class_id);
61 extern AttrNumber get_object_attnum_name(Oid class_id);
63 extern AttrNumber get_object_attnum_owner(Oid class_id);
64 extern AttrNumber get_object_attnum_acl(Oid class_id);
65 extern AclObjectKind get_object_aclkind(Oid class_id);
66 extern bool get_object_namensp_unique(Oid class_id);
67 
69  Oid objectId);
70 
71 extern char *getObjectDescription(const ObjectAddress *object);
72 extern char *getObjectDescriptionOids(Oid classid, Oid objid);
73 
74 extern int read_objtype_from_string(const char *objtype);
75 extern char *getObjectTypeDescription(const ObjectAddress *object);
76 extern char *getObjectIdentity(const ObjectAddress *address);
77 extern char *getObjectIdentityParts(const ObjectAddress *address,
78  List **objname, List **objargs);
80 
81 #endif /* OBJECTADDRESS_H */
struct ObjectAddress ObjectAddress
const ObjectAddress InvalidObjectAddress
int LOCKMODE
Definition: lockdefs.h:26
AttrNumber get_object_attnum_name(Oid class_id)
ObjectAddress get_object_address(ObjectType objtype, List *objname, List *objargs, Relation *relp, LOCKMODE lockmode, bool missing_ok)
unsigned int Oid
Definition: postgres_ext.h:31
signed int int32
Definition: c.h:253
char * getObjectTypeDescription(const ObjectAddress *object)
bool is_objectclass_supported(Oid class_id)
Oid get_object_namespace(const ObjectAddress *address)
ObjectAddress get_object_address_rv(ObjectType objtype, RangeVar *rel, List *objname, List *objargs, Relation *relp, LOCKMODE lockmode, bool missing_ok)
char * getObjectIdentityParts(const ObjectAddress *address, List **objname, List **objargs)
AttrNumber get_object_attnum_namespace(Oid class_id)
ArrayType * strlist_to_textarray(List *list)
AttrNumber get_object_attnum_owner(Oid class_id)
char * getObjectIdentity(const ObjectAddress *address)
char * getObjectDescription(const ObjectAddress *object)
int read_objtype_from_string(const char *objtype)
HeapTuple get_catalog_object_by_oid(Relation catalog, Oid objectId)
ObjectType
Definition: parsenodes.h:1520
bool get_object_namensp_unique(Oid class_id)
AclObjectKind get_object_aclkind(Oid class_id)
int get_object_catcache_oid(Oid class_id)
char * getObjectDescriptionOids(Oid classid, Oid objid)
int get_object_catcache_name(Oid class_id)
Oid get_object_oid_index(Oid class_id)
tuple list
Definition: sort-test.py:11
void check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, List *objname, List *objargs, Relation relation)
AttrNumber get_object_attnum_acl(Oid class_id)
AclObjectKind
Definition: acl.h:179
Definition: pg_list.h:45
int16 AttrNumber
Definition: attnum.h:21