PostgreSQL Source Code  git master
pg_init_privs.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_init_privs.h
4  * definition of the "initial privileges" system catalog (pg_init_privs)
5  *
6  * NOTE: an object is identified by the OID of the row that primarily
7  * defines the object, plus the OID of the table that that row appears in.
8  * For example, a function is identified by the OID of its pg_proc row
9  * plus the pg_class OID of table pg_proc. This allows unique identification
10  * of objects without assuming that OIDs are unique across tables.
11  *
12  * Since attributes don't have OIDs of their own, we identify an attribute
13  * privilege by the objoid+classoid of its parent table, plus an "objsubid"
14  * giving the attribute column number. "objsubid" must be zero in a privilege
15  * for a table itself, so that it is distinct from any column privilege.
16  * Currently, objsubid is unused and zero for all other kinds of objects.
17  *
18  * Because the contents of this table depend on what is done with the other
19  * objects in the system (and, in particular, may change due to changes in
20  * system_views.sql), there is no pg_init_privs.dat file. The initial contents
21  * are loaded near the end of initdb.
22  *
23  *
24  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
25  * Portions Copyright (c) 1994, Regents of the University of California
26  *
27  * src/include/catalog/pg_init_privs.h
28  *
29  * NOTES
30  * The Catalog.pm module reads this file and derives schema
31  * information.
32  *
33  *-------------------------------------------------------------------------
34  */
35 #ifndef PG_INIT_PRIVS_H
36 #define PG_INIT_PRIVS_H
37 
38 #include "catalog/genbki.h"
39 #include "catalog/pg_init_privs_d.h"
40 
41 /* ----------------
42  * pg_init_privs definition. cpp turns this into
43  * typedef struct FormData_pg_init_privs
44  * ----------------
45  */
46 CATALOG(pg_init_privs,3394,InitPrivsRelationId)
47 {
48  Oid objoid; /* OID of object itself */
49  Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing
50  * object */
51  int32 objsubid; /* column number, or 0 if not used */
52  char privtype; /* from initdb or extension? */
53 
54 #ifdef CATALOG_VARLEN /* variable-length fields start here */
55  aclitem initprivs[1] BKI_FORCE_NOT_NULL; /* initial privs on object */
56 #endif
58 
59 /* ----------------
60  * Form_pg_init_privs corresponds to a pointer to a tuple with
61  * the format of pg_init_privs relation.
62  * ----------------
63  */
65 
66 DECLARE_TOAST(pg_init_privs, 4155, 4156);
67 
68 DECLARE_UNIQUE_INDEX_PKEY(pg_init_privs_o_c_o_index, 3395, on pg_init_privs using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops));
69 #define InitPrivsObjIndexId 3395
70 
71 /*
72  * It is important to know if the initial privileges are from initdb or from an
73  * extension. This enum is used to provide that differentiation and the two
74  * places which populate this table (initdb and during CREATE EXTENSION, see
75  * recordExtensionInitPriv()) know to use the correct values.
76  */
77 
78 typedef enum InitPrivsType
79 {
83 
84 #endif /* PG_INIT_PRIVS_H */
FormData_pg_init_privs
Definition: pg_init_privs.h:57
unsigned int Oid
Definition: postgres_ext.h:31
signed int int32
Definition: c.h:429
#define BKI_FORCE_NOT_NULL
Definition: genbki.h:33
CATALOG(pg_init_privs, 3394, InitPrivsRelationId)
Definition: pg_init_privs.h:46
DECLARE_TOAST(pg_init_privs, 4155, 4156)
#define BKI_LOOKUP(catalog)
Definition: genbki.h:46
InitPrivsType
Definition: pg_init_privs.h:78
DECLARE_UNIQUE_INDEX_PKEY(pg_init_privs_o_c_o_index, 3395, on pg_init_privs using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops))
FormData_pg_init_privs * Form_pg_init_privs
Definition: pg_init_privs.h:64