PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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-2026, 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 "access/htup.h"
17#include "nodes/parsenodes.h"
18#include "storage/lockdefs.h"
19#include "utils/relcache.h"
20#include "utils/syscache.h"
21
22/*
23 * An ObjectAddress represents a database object of any type.
24 */
25typedef struct ObjectAddress
26{
27 Oid classId; /* Class Id from pg_class */
28 Oid objectId; /* OID of the object */
29 int32 objectSubId; /* Subitem within object (eg column), or 0 */
31
33
34#define ObjectAddressSubSet(addr, class_id, object_id, object_sub_id) \
35 do { \
36 (addr).classId = (class_id); \
37 (addr).objectId = (object_id); \
38 (addr).objectSubId = (object_sub_id); \
39 } while (0)
40
41#define ObjectAddressSet(addr, class_id, object_id) \
42 ObjectAddressSubSet(addr, class_id, object_id, 0)
43
44extern ObjectAddress get_object_address(ObjectType objtype, Node *object,
46 LOCKMODE lockmode, bool missing_ok);
47
49 List *object, Relation *relp,
50 LOCKMODE lockmode, bool missing_ok);
51
52extern void check_object_ownership(Oid roleid,
53 ObjectType objtype, ObjectAddress address,
54 Node *object, Relation relation);
55
56extern Oid get_object_namespace(const ObjectAddress *address);
57
59extern const char *get_object_class_descr(Oid class_id);
68extern ObjectType get_object_type(Oid class_id, Oid object_id);
70
72 AttrNumber oidcol, Oid objectId);
75 Oid objectId,
76 bool locktup);
77
78extern char *getObjectDescription(const ObjectAddress *object,
79 bool missing_ok);
80extern char *getObjectDescriptionOids(Oid classid, Oid objid);
81
82extern int read_objtype_from_string(const char *objtype);
83extern char *getObjectTypeDescription(const ObjectAddress *object,
84 bool missing_ok);
85extern char *getObjectIdentity(const ObjectAddress *object,
86 bool missing_ok);
87extern char *getObjectIdentityParts(const ObjectAddress *object,
88 List **objname, List **objargs,
89 bool missing_ok);
90extern struct ArrayType *strlist_to_textarray(List *list);
91
92extern ObjectType get_relkind_objtype(char relkind);
93
94#endif /* OBJECTADDRESS_H */
int16 AttrNumber
Definition attnum.h:21
#define PGDLLIMPORT
Definition c.h:1356
int32_t int32
Definition c.h:554
int LOCKMODE
Definition lockdefs.h:26
char * getObjectTypeDescription(const ObjectAddress *object, bool missing_ok)
bool get_object_namensp_unique(Oid class_id)
ObjectAddress get_object_address_rv(ObjectType objtype, RangeVar *rel, List *object, Relation *relp, LOCKMODE lockmode, bool missing_ok)
AttrNumber get_object_attnum_owner(Oid class_id)
HeapTuple get_catalog_object_by_oid(Relation catalog, AttrNumber oidcol, Oid objectId)
AttrNumber get_object_attnum_oid(Oid class_id)
ObjectType get_relkind_objtype(char relkind)
AttrNumber get_object_attnum_namespace(Oid class_id)
void check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, Node *object, Relation relation)
SysCacheIdentifier get_object_catcache_name(Oid class_id)
char * getObjectDescriptionOids(Oid classid, Oid objid)
char * getObjectIdentityParts(const ObjectAddress *object, List **objname, List **objargs, bool missing_ok)
AttrNumber get_object_attnum_name(Oid class_id)
const char * get_object_class_descr(Oid class_id)
char * getObjectDescription(const ObjectAddress *object, bool missing_ok)
PGDLLIMPORT const ObjectAddress InvalidObjectAddress
AttrNumber get_object_attnum_acl(Oid class_id)
Oid get_object_oid_index(Oid class_id)
int read_objtype_from_string(const char *objtype)
SysCacheIdentifier get_object_catcache_oid(Oid class_id)
ObjectType get_object_type(Oid class_id, Oid object_id)
ObjectAddress get_object_address(ObjectType objtype, Node *object, Relation *relp, LOCKMODE lockmode, bool missing_ok)
char * getObjectIdentity(const ObjectAddress *object, bool missing_ok)
struct ArrayType * strlist_to_textarray(List *list)
Oid get_object_namespace(const ObjectAddress *address)
HeapTuple get_catalog_object_by_oid_extended(Relation catalog, AttrNumber oidcol, Oid objectId, bool locktup)
bool is_objectclass_supported(Oid class_id)
ObjectType
unsigned int Oid
static int fb(int x)
Definition pg_list.h:54
Definition nodes.h:135