codekingpro/portable-devtools
114k
1/*-------------------------------------------------------------------------2 *3 * pg_init_privs.h4 * definition of the "initial privileges" system catalog (pg_init_privs)5 *6 * NOTE: an object is identified by the OID of the row that primarily7 * 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 row9 * plus the pg_class OID of table pg_proc. This allows unique identification10 * of objects without assuming that OIDs are unique across tables.11 *12 * Since attributes don't have OIDs of their own, we identify an attribute13 * privilege by the objoid+classoid of its parent table, plus an "objsubid"14 * giving the attribute column number. "objsubid" must be zero in a privilege15 * 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 other19 * objects in the system (and, in particular, may change due to changes in20 * system_views.sql), there is no pg_init_privs.dat file. The initial contents21 * are loaded near the end of initdb.22 *23 *24 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group25 * Portions Copyright (c) 1994, Regents of the University of California26 *27 * src/include/catalog/pg_init_privs.h28 *29 * NOTES30 * The Catalog.pm module reads this file and derives schema31 * information.32 *33 *-------------------------------------------------------------------------34 */35#ifndef PG_INIT_PRIVS_H36#define PG_INIT_PRIVS_H37 38#include "catalog/genbki.h"39#include "catalog/pg_init_privs_d.h"40 41/* ----------------42 * pg_init_privs definition. cpp turns this into43 * typedef struct FormData_pg_init_privs44 * ----------------45 */46CATALOG(pg_init_privs,3394,InitPrivsRelationId)47{48 Oid objoid; /* OID of object itself */49 Oid classoid BKI_LOOKUP(pg_class); /* OID of table containing50 * 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#endif57} FormData_pg_init_privs;58 59/* ----------------60 * Form_pg_init_privs corresponds to a pointer to a tuple with61 * the format of pg_init_privs relation.62 * ----------------63 */64typedef FormData_pg_init_privs * Form_pg_init_privs;65 66DECLARE_TOAST(pg_init_privs, 4155, 4156);67 68DECLARE_UNIQUE_INDEX_PKEY(pg_init_privs_o_c_o_index, 3395, InitPrivsObjIndexId, on pg_init_privs using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops));69 70/*71 * It is important to know if the initial privileges are from initdb or from an72 * extension. This enum is used to provide that differentiation and the two73 * places which populate this table (initdb and during CREATE EXTENSION, see74 * recordExtensionInitPriv()) know to use the correct values.75 */76 77typedef enum InitPrivsType78{79 INITPRIVS_INITDB = 'i',80 INITPRIVS_EXTENSION = 'e'81} InitPrivsType;82 83#endif /* PG_INIT_PRIVS_H */84 