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 object */ 53 #endif 54 } FormData_pg_init_privs; 55 56 /* ---------------- 57 * Form_pg_init_privs corresponds to a pointer to a tuple with 58 * the format of pg_init_privs relation. 59 * ---------------- 60 */ 61 typedef FormData_pg_init_privs * Form_pg_init_privs; 62 63 /* ---------------- 64 * compiler constants for pg_init_privs 65 * ---------------- 66 */ 67 #define Natts_pg_init_privs 5 68 #define Anum_pg_init_privs_objoid 1 69 #define Anum_pg_init_privs_classoid 2 70 #define Anum_pg_init_privs_objsubid 3 71 #define Anum_pg_init_privs_privtype 4 72 #define Anum_pg_init_privs_privs 5 73 74 /* 75 * It is important to know if the initial privileges are from initdb or from an 76 * extension. This enum is used to provide that differentiation and the two 77 * places which populate this table (initdb and during CREATE EXTENSION, see 78 * recordExtensionInitPriv()) know to use the correct values. 79 */ 80 81 typedef enum InitPrivsType 82 { 83 INITPRIVS_INITDB = 'i', 84 INITPRIVS_EXTENSION = 'e' 85 } InitPrivsType; 86 87 /* ---------------- 88 * initial contents of pg_init_privs 89 * ---------------- 90 */ 91 92 /* 93 * Because the contents of this table depend on what is done with the other 94 * objects in the system (and, in particular, may change due to changes is 95 * system_views.sql), there is no initialization here. 96 * 97 * The initial contents are loaded near the end of initdb. 98 */ 99 100 #endif /* PG_INIT_PRIVS_H */ 101