PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pg_init_privs.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pg_init_privs.h
4  * definition of the system "initial privileges" relation (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  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
19  * Portions Copyright (c) 1994, Regents of the University of California
20  *
21  * src/include/catalog/pg_init_privs.h
22  *
23  * NOTES
24  * the genbki.pl script reads this file and generates .bki
25  * information from the DATA() statements.
26  *
27  * XXX do NOT break up DATA() statements into multiple lines!
28  * the scripts are not as smart as you might think...
29  *
30  *-------------------------------------------------------------------------
31  */
32 #ifndef PG_INIT_PRIVS_H
33 #define PG_INIT_PRIVS_H
34 
35 #include "catalog/genbki.h"
36 
37 /* ----------------
38  * pg_init_privs definition. cpp turns this into
39  * typedef struct FormData_pg_init_privs
40  * ----------------
41  */
42 #define InitPrivsRelationId 3394
43 
44 CATALOG(pg_init_privs,3394) BKI_WITHOUT_OIDS
45 {
46  Oid objoid; /* OID of object itself */
47  Oid classoid; /* OID of table containing object */
48  int32 objsubid; /* column number, or 0 if not used */
49  char privtype; /* from initdb or extension? */
50 
51 #ifdef CATALOG_VARLEN /* variable-length fields start here */
52  aclitem initprivs[1] BKI_FORCE_NOT_NULL; /* initial privs on
53  * object */
54 #endif
56 
57 /* ----------------
58  * Form_pg_init_privs corresponds to a pointer to a tuple with
59  * the format of pg_init_privs relation.
60  * ----------------
61  */
63 
64 /* ----------------
65  * compiler constants for pg_init_privs
66  * ----------------
67  */
68 #define Natts_pg_init_privs 5
69 #define Anum_pg_init_privs_objoid 1
70 #define Anum_pg_init_privs_classoid 2
71 #define Anum_pg_init_privs_objsubid 3
72 #define Anum_pg_init_privs_privtype 4
73 #define Anum_pg_init_privs_privs 5
74 
75 /*
76  * It is important to know if the initial privileges are from initdb or from an
77  * extension. This enum is used to provide that differentiation and the two
78  * places which populate this table (initdb and during CREATE EXTENSION, see
79  * recordExtensionInitPriv()) know to use the correct values.
80  */
81 
82 typedef enum InitPrivsType
83 {
87 
88 /* ----------------
89  * initial contents of pg_init_privs
90  * ----------------
91  */
92 
93 /*
94  * Because the contents of this table depend on what is done with the other
95  * objects in the system (and, in particular, may change due to changes is
96  * system_views.sql), there is no initialization here.
97  *
98  * The initial contents are loaded near the end of initdb.
99  */
100 
101 #endif /* PG_INIT_PRIVS_H */
FormData_pg_init_privs
Definition: pg_init_privs.h:55
unsigned int Oid
Definition: postgres_ext.h:31
CATALOG(pg_init_privs, 3394) BKI_WITHOUT_OIDS
Definition: pg_init_privs.h:44
signed int int32
Definition: c.h:253
#define BKI_WITHOUT_OIDS
Definition: genbki.h:28
#define BKI_FORCE_NOT_NULL
Definition: genbki.h:32
InitPrivsType
Definition: pg_init_privs.h:82
FormData_pg_init_privs * Form_pg_init_privs
Definition: pg_init_privs.h:62