diff options
Diffstat (limited to 'src/include')
34 files changed, 387 insertions, 401 deletions
diff --git a/src/include/access/twophase.h b/src/include/access/twophase.h index 08f1f9bd9fe..e90b9e304db 100644 --- a/src/include/access/twophase.h +++ b/src/include/access/twophase.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/twophase.h,v 1.3 2005/06/19 20:00:39 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/twophase.h,v 1.4 2005/06/28 05:09:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -34,7 +34,7 @@ extern PGPROC *TwoPhaseGetDummyProc(TransactionId xid); extern GlobalTransaction MarkAsPreparing(TransactionId xid, const char *gid, TimestampTz prepared_at, - AclId owner, Oid databaseid); + Oid owner, Oid databaseid); extern void StartPrepare(GlobalTransaction gxact); extern void EndPrepare(GlobalTransaction gxact); diff --git a/src/include/c.h b/src/include/c.h index 1a920387747..202e45271e5 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.185 2005/06/08 15:50:28 tgl Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.186 2005/06/28 05:09:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -366,7 +366,7 @@ typedef double float8; /* * Oid, RegProcedure, TransactionId, SubTransactionId, MultiXactId, - * CommandId, AclId + * CommandId */ /* typedef Oid is in postgres_ext.h */ @@ -394,8 +394,6 @@ typedef uint32 CommandId; #define FirstCommandId ((CommandId) 0) -typedef int32 AclId; /* user and group identifiers */ - /* * Array indexing support */ @@ -507,8 +505,6 @@ typedef NameData *Name; #define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid)) -#define AclIdIsValid(aclId) ((bool) ((aclId) != 0)) - #define RegProcedureIsValid(p) OidIsValid(p) diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 1e5c7ce0fa0..5a1943723dc 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.282 2005/06/27 12:45:22 teodor Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.283 2005/06/28 05:09:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200506271 +#define CATALOG_VERSION_NO 200506272 #endif diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h index 8be3527be2c..757a2095792 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/indexing.h,v 1.87 2005/04/14 20:03:27 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/indexing.h,v 1.88 2005/06/28 05:09:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -83,6 +83,16 @@ DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index,2658, on pg_attribute using DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnum_index,2659, on pg_attribute using btree(attrelid oid_ops, attnum int2_ops)); #define AttributeRelidNumIndexId 2659 +DECLARE_UNIQUE_INDEX(pg_authid_rolname_index,2676, on pg_authid using btree(rolname name_ops)); +#define AuthIdRolnameIndexId 2676 +DECLARE_UNIQUE_INDEX(pg_authid_oid_index,2677, on pg_authid using btree(oid oid_ops)); +#define AuthIdOidIndexId 2677 + +DECLARE_UNIQUE_INDEX(pg_auth_members_role_member_index,2694, on pg_auth_members using btree(roleid oid_ops, member oid_ops)); +#define AuthMemRoleMemIndexId 2694 +DECLARE_UNIQUE_INDEX(pg_auth_members_member_role_index,2695, on pg_auth_members using btree(member oid_ops, roleid oid_ops)); +#define AuthMemMemRoleIndexId 2695 + DECLARE_UNIQUE_INDEX(pg_cast_oid_index,2660, on pg_cast using btree(oid oid_ops)); #define CastOidIndexId 2660 DECLARE_UNIQUE_INDEX(pg_cast_source_target_index,2661, on pg_cast using btree(castsource oid_ops, casttarget oid_ops)); @@ -127,11 +137,6 @@ DECLARE_INDEX(pg_depend_reference_index,2674, on pg_depend using btree(refclassi DECLARE_UNIQUE_INDEX(pg_description_o_c_o_index,2675, on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops)); #define DescriptionObjIndexId 2675 -DECLARE_UNIQUE_INDEX(pg_group_name_index,2676, on pg_group using btree(groname name_ops)); -#define GroupNameIndexId 2676 -DECLARE_UNIQUE_INDEX(pg_group_sysid_index,2677, on pg_group using btree(grosysid int4_ops)); -#define GroupSysidIndexId 2677 - /* This following index is not used for a cache and is not unique */ DECLARE_INDEX(pg_index_indrelid_index,2678, on pg_index using btree(indrelid oid_ops)); #define IndexIndrelidIndexId 2678 @@ -174,11 +179,6 @@ DECLARE_UNIQUE_INDEX(pg_rewrite_oid_index,2692, on pg_rewrite using btree(oid oi DECLARE_UNIQUE_INDEX(pg_rewrite_rel_rulename_index,2693, on pg_rewrite using btree(ev_class oid_ops, rulename name_ops)); #define RewriteRelRulenameIndexId 2693 -DECLARE_UNIQUE_INDEX(pg_shadow_usename_index,2694, on pg_shadow using btree(usename name_ops)); -#define ShadowNameIndexId 2694 -DECLARE_UNIQUE_INDEX(pg_shadow_usesysid_index,2695, on pg_shadow using btree(usesysid int4_ops)); -#define ShadowSysidIndexId 2695 - DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_index,2696, on pg_statistic using btree(starelid oid_ops, staattnum int2_ops)); #define StatisticRelidAttnumIndexId 2696 diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index ddca993a68a..bda89f44054 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.117 2005/04/29 22:28:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.118 2005/06/28 05:09:04 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -226,7 +226,7 @@ typedef FormData_pg_attribute *Form_pg_attribute; #define Schema_pg_type \ { 1247, {"typname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ { 1247, {"typnamespace"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ -{ 1247, {"typowner"}, 23, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ +{ 1247, {"typowner"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1247, {"typlen"}, 21, -1, 2, 4, 0, -1, -1, true, 'p', 's', true, false, false, true, 0 }, \ { 1247, {"typbyval"}, 16, -1, 1, 5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \ { 1247, {"typtype"}, 18, -1, 1, 6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \ @@ -250,7 +250,7 @@ typedef FormData_pg_attribute *Form_pg_attribute; DATA(insert ( 1247 typname 19 -1 NAMEDATALEN 1 0 -1 -1 f p i t f f t 0)); DATA(insert ( 1247 typnamespace 26 -1 4 2 0 -1 -1 t p i t f f t 0)); -DATA(insert ( 1247 typowner 23 -1 4 3 0 -1 -1 t p i t f f t 0)); +DATA(insert ( 1247 typowner 26 -1 4 3 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1247 typlen 21 -1 2 4 0 -1 -1 t p s t f f t 0)); DATA(insert ( 1247 typbyval 16 -1 1 5 0 -1 -1 t p c t f f t 0)); DATA(insert ( 1247 typtype 18 -1 1 6 0 -1 -1 t p c t f f t 0)); @@ -286,7 +286,7 @@ DATA(insert ( 1247 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); #define Schema_pg_proc \ { 1255, {"proname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ { 1255, {"pronamespace"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ -{ 1255, {"proowner"}, 23, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ +{ 1255, {"proowner"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1255, {"prolang"}, 26, -1, 4, 4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1255, {"proisagg"}, 16, -1, 1, 5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \ { 1255, {"prosecdef"}, 16, -1, 1, 6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0 }, \ @@ -305,7 +305,7 @@ DATA(insert ( 1247 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1255 proname 19 -1 NAMEDATALEN 1 0 -1 -1 f p i t f f t 0)); DATA(insert ( 1255 pronamespace 26 -1 4 2 0 -1 -1 t p i t f f t 0)); -DATA(insert ( 1255 proowner 23 -1 4 3 0 -1 -1 t p i t f f t 0)); +DATA(insert ( 1255 proowner 26 -1 4 3 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1255 prolang 26 -1 4 4 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1255 proisagg 16 -1 1 5 0 -1 -1 t p c t f f t 0)); DATA(insert ( 1255 prosecdef 16 -1 1 6 0 -1 -1 t p c t f f t 0)); @@ -385,7 +385,7 @@ DATA(insert ( 1249 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); { 1259, {"relname"}, 19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'i', true, false, false, true, 0 }, \ { 1259, {"relnamespace"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1259, {"reltype"}, 26, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ -{ 1259, {"relowner"}, 23, -1, 4, 4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ +{ 1259, {"relowner"}, 26, -1, 4, 4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1259, {"relam"}, 26, -1, 4, 5, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1259, {"relfilenode"}, 26, -1, 4, 6, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { 1259, {"reltablespace"}, 26, -1, 4, 7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ @@ -411,7 +411,7 @@ DATA(insert ( 1249 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1259 relname 19 -1 NAMEDATALEN 1 0 -1 -1 f p i t f f t 0)); DATA(insert ( 1259 relnamespace 26 -1 4 2 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1259 reltype 26 -1 4 3 0 -1 -1 t p i t f f t 0)); -DATA(insert ( 1259 relowner 23 -1 4 4 0 -1 -1 t p i t f f t 0)); +DATA(insert ( 1259 relowner 26 -1 4 4 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1259 relam 26 -1 4 5 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1259 relfilenode 26 -1 4 6 0 -1 -1 t p i t f f t 0)); DATA(insert ( 1259 reltablespace 26 -1 4 7 0 -1 -1 t p i t f f t 0)); diff --git a/src/include/catalog/pg_auth_members.h b/src/include/catalog/pg_auth_members.h new file mode 100644 index 00000000000..e08fd2e6ae1 --- /dev/null +++ b/src/include/catalog/pg_auth_members.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * pg_auth_members.h + * definition of the system "authorization identifier members" relation + * (pg_auth_members) along with the relation's initial contents. + * + * + * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $PostgreSQL: pgsql/src/include/catalog/pg_auth_members.h,v 1.1 2005/06/28 05:09:04 tgl Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTH_MEMBERS_H +#define PG_AUTH_MEMBERS_H + +/* ---------------- + * pg_auth_members definition. cpp turns this into + * typedef struct FormData_pg_auth_members + * ---------------- + */ +#define AuthMemRelationId 1261 + +CATALOG(pg_auth_members,1261) BKI_SHARED_RELATION BKI_WITHOUT_OIDS +{ + Oid roleid; /* ID of a role */ + Oid member; /* ID of a member of that role */ + Oid grantor; /* who granted the membership */ + bool admin_option; /* granted with admin option? */ +} FormData_pg_auth_members; + +/* ---------------- + * Form_pg_auth_members corresponds to a pointer to a tuple with + * the format of pg_auth_members relation. + * ---------------- + */ +typedef FormData_pg_auth_members *Form_pg_auth_members; + +/* ---------------- + * compiler constants for pg_auth_members + * ---------------- + */ +#define Natts_pg_auth_members 4 +#define Anum_pg_auth_members_roleid 1 +#define Anum_pg_auth_members_member 2 +#define Anum_pg_auth_members_grantor 3 +#define Anum_pg_auth_members_admin_option 4 + +#endif /* PG_AUTH_MEMBERS_H */ diff --git a/src/include/catalog/pg_authid.h b/src/include/catalog/pg_authid.h new file mode 100644 index 00000000000..2ea15fea8a1 --- /dev/null +++ b/src/include/catalog/pg_authid.h @@ -0,0 +1,94 @@ +/*------------------------------------------------------------------------- + * + * pg_authid.h + * definition of the system "authorization identifier" relation (pg_authid) + * along with the relation's initial contents. + * + * pg_shadow and pg_group are now publicly accessible views on pg_authid. + * + * + * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $PostgreSQL: pgsql/src/include/catalog/pg_authid.h,v 1.1 2005/06/28 05:09:05 tgl Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AUTHID_H +#define PG_AUTHID_H + +/* + * The CATALOG definition has to refer to the type of rolvaliduntil as + * "timestamptz" (lower case) so that bootstrap mode recognizes it. But + * the C header files define this type as TimestampTz. Since the field is + * potentially-null and therefore can't be accessed directly from C code, + * there is no particular need for the C struct definition to show the + * field type as TimestampTz --- instead we just make it Datum. + */ + +#define timestamptz Datum + + +/* ---------------- + * pg_authid definition. cpp turns this into + * typedef struct FormData_pg_authid + * ---------------- + */ +#define AuthIdRelationId 1260 + +CATALOG(pg_authid,1260) BKI_SHARED_RELATION +{ + NameData rolname; /* name of role */ + bool rolsuper; /* read this field via superuser() only! */ + bool rolcreaterole; /* allowed to create more roles? */ + bool rolcreatedb; /* allowed to create databases? */ + bool rolcatupdate; /* allowed to alter catalogs manually? */ + bool rolcanlogin; /* allowed to log in as session user? */ + + /* remaining fields may be null; use heap_getattr to read them! */ + text rolpassword; /* password, if any */ + timestamptz rolvaliduntil; /* password expiration time, if any */ + text rolconfig[1]; /* GUC settings to apply at login */ +} FormData_pg_authid; + +#undef timestamptz + + +/* ---------------- + * Form_pg_authid corresponds to a pointer to a tuple with + * the format of pg_authid relation. + * ---------------- + */ +typedef FormData_pg_authid *Form_pg_authid; + +/* ---------------- + * compiler constants for pg_authid + * ---------------- + */ +#define Natts_pg_authid 9 +#define Anum_pg_authid_rolname 1 +#define Anum_pg_authid_rolsuper 2 +#define Anum_pg_authid_rolcreaterole 3 +#define Anum_pg_authid_rolcreatedb 4 +#define Anum_pg_authid_rolcatupdate 5 +#define Anum_pg_authid_rolcanlogin 6 +#define Anum_pg_authid_rolpassword 7 +#define Anum_pg_authid_rolvaliduntil 8 +#define Anum_pg_authid_rolconfig 9 + +/* ---------------- + * initial contents of pg_authid + * + * The uppercase quantities will be replaced at initdb time with + * user choices. + * ---------------- + */ +DATA(insert OID = 10 ( "POSTGRES" t t t t t _null_ _null_ _null_ )); + +#define BOOTSTRAP_SUPERUSERID 10 + +#endif /* PG_AUTHID_H */ diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index e08d6d60d33..b6d8f556b48 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_class.h,v 1.88 2005/04/29 22:28:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_class.h,v 1.89 2005/06/28 05:09:05 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -47,7 +47,7 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP NameData relname; /* class name */ Oid relnamespace; /* OID of namespace containing this class */ Oid reltype; /* OID of associated entry in pg_type */ - int4 relowner; /* class owner */ + Oid relowner; /* class owner */ Oid relam; /* index access method; 0 if not an index */ Oid relfilenode; /* identifier of physical storage file */ Oid reltablespace; /* identifier of table space for relation */ diff --git a/src/include/catalog/pg_conversion.h b/src/include/catalog/pg_conversion.h index e9cd3ccca24..eb874446455 100644 --- a/src/include/catalog/pg_conversion.h +++ b/src/include/catalog/pg_conversion.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_conversion.h,v 1.15 2005/04/14 01:38:20 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_conversion.h,v 1.16 2005/06/28 05:09:05 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -46,7 +46,7 @@ CATALOG(pg_conversion,2607) { NameData conname; Oid connamespace; - int4 conowner; + Oid conowner; int4 conforencoding; int4 contoencoding; regproc conproc; @@ -86,7 +86,7 @@ typedef FormData_pg_conversion *Form_pg_conversion; #include "nodes/parsenodes.h" extern Oid ConversionCreate(const char *conname, Oid connamespace, - AclId conowner, + Oid conowner, int32 conforencoding, int32 contoencoding, Oid conproc, bool def); extern void ConversionDrop(Oid conversionOid, DropBehavior behavior); diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h index 69b41e31720..37c57f8508c 100644 --- a/src/include/catalog/pg_database.h +++ b/src/include/catalog/pg_database.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_database.h,v 1.35 2005/04/14 01:38:20 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_database.h,v 1.36 2005/06/28 05:09:06 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -36,7 +36,7 @@ CATALOG(pg_database,1262) BKI_SHARED_RELATION { NameData datname; /* database name */ - int4 datdba; /* sysid of owner */ + Oid datdba; /* owner of database */ int4 encoding; /* character encoding */ bool datistemplate; /* allowed as CREATE DATABASE template? */ bool datallowconn; /* new connections allowed? */ diff --git a/src/include/catalog/pg_group.h b/src/include/catalog/pg_group.h deleted file mode 100644 index 216d51a6660..00000000000 --- a/src/include/catalog/pg_group.h +++ /dev/null @@ -1,45 +0,0 @@ -/*------------------------------------------------------------------------- - * - * pg_group.h - * - * - * - * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * $PostgreSQL: pgsql/src/include/catalog/pg_group.h,v 1.21 2005/04/14 01:38:20 tgl Exp $ - * - * NOTES - * the genbki.sh script reads this file and generates .bki - * information from the DATA() statements. - * - *------------------------------------------------------------------------- - */ -#ifndef PG_GROUP_H -#define PG_GROUP_H - -/* ---------------- - * postgres.h contains the system type definitions and the - * CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file - * can be read by both genbki.sh and the C compiler. - * ---------------- - */ -#define GroupRelationId 1261 - -CATALOG(pg_group,1261) BKI_SHARED_RELATION BKI_WITHOUT_OIDS -{ - NameData groname; - int4 grosysid; - int4 grolist[1]; -} FormData_pg_group; - -/* VARIABLE LENGTH STRUCTURE */ - -typedef FormData_pg_group *Form_pg_group; - -#define Natts_pg_group 3 -#define Anum_pg_group_groname 1 -#define Anum_pg_group_grosysid 2 -#define Anum_pg_group_grolist 3 - -#endif /* PG_GROUP_H */ diff --git a/src/include/catalog/pg_namespace.h b/src/include/catalog/pg_namespace.h index f6cb4cf8e5b..c460500578c 100644 --- a/src/include/catalog/pg_namespace.h +++ b/src/include/catalog/pg_namespace.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_namespace.h,v 1.17 2005/04/14 01:38:20 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_namespace.h,v 1.18 2005/06/28 05:09:06 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -41,7 +41,7 @@ CATALOG(pg_namespace,2615) { NameData nspname; - int4 nspowner; + Oid nspowner; aclitem nspacl[1]; /* VARIABLE LENGTH FIELD */ } FormData_pg_namespace; @@ -82,6 +82,6 @@ DESCR("Standard public schema"); /* * prototypes for functions in pg_namespace.c */ -extern Oid NamespaceCreate(const char *nspName, int32 ownerSysId); +extern Oid NamespaceCreate(const char *nspName, Oid ownerId); #endif /* PG_NAMESPACE_H */ diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h index 6043fec22d0..23485ff0ebb 100644 --- a/src/include/catalog/pg_opclass.h +++ b/src/include/catalog/pg_opclass.h @@ -27,7 +27,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_opclass.h,v 1.64 2005/04/14 01:38:20 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_opclass.h,v 1.65 2005/06/28 05:09:07 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -57,7 +57,7 @@ CATALOG(pg_opclass,2616) Oid opcamid; /* index access method opclass is for */ NameData opcname; /* name of this opclass */ Oid opcnamespace; /* namespace of this opclass */ - int4 opcowner; /* opclass owner */ + Oid opcowner; /* opclass owner */ Oid opcintype; /* type of data indexed by opclass */ bool opcdefault; /* T if opclass is default for opcintype */ Oid opckeytype; /* type of data in index, or InvalidOid */ diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index f87b6a07383..9de43736eae 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.134 2005/06/24 20:53:31 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.135 2005/06/28 05:09:07 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -42,7 +42,7 @@ CATALOG(pg_operator,2617) { NameData oprname; /* name of operator */ Oid oprnamespace; /* OID of namespace containing this oper */ - int4 oprowner; /* oper owner */ + Oid oprowner; /* operator owner */ char oprkind; /* 'l', 'r', or 'b' */ bool oprcanhash; /* can be used in hash join? */ Oid oprleft; /* left arg type, or 0 if 'l' oprkind */ diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 049024ae40c..5326a770592 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.371 2005/06/26 03:04:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.372 2005/06/28 05:09:09 tgl Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -41,7 +41,7 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP { NameData proname; /* procedure name */ Oid pronamespace; /* OID of namespace containing this proc */ - int4 proowner; /* proc owner */ + Oid proowner; /* procedure owner */ Oid prolang; /* OID of pg_language entry */ bool proisagg; /* is it an aggregate? */ bool prosecdef; /* security definer */ @@ -1355,7 +1355,7 @@ DATA(insert OID = 1037 ( aclcontains PGNSP PGUID 12 f f t f i 2 16 "1034 103 DESCR("does ACL contain item?"); DATA(insert OID = 1062 ( aclitemeq PGNSP PGUID 12 f f t f i 2 16 "1033 1033" _null_ _null_ _null_ aclitem_eq - _null_ )); DESCR("equality operator for ACL items"); -DATA(insert OID = 1365 ( makeaclitem PGNSP PGUID 12 f f t f i 5 1033 "23 23 23 25 16" _null_ _null_ _null_ makeaclitem - _null_ )); +DATA(insert OID = 1365 ( makeaclitem PGNSP PGUID 12 f f t f i 4 1033 "26 26 25 16" _null_ _null_ _null_ makeaclitem - _null_ )); DESCR("make ACL item"); DATA(insert OID = 1044 ( bpcharin PGNSP PGUID 12 f f t f i 3 1042 "2275 26 23" _null_ _null_ _null_ bpcharin - _null_ )); DESCR("I/O"); @@ -2251,8 +2251,8 @@ DATA(insert OID = 1640 ( pg_get_viewdef PGNSP PGUID 12 f f t f s 1 25 "25" _ DESCR("select statement of a view"); DATA(insert OID = 1641 ( pg_get_viewdef PGNSP PGUID 12 f f t f s 1 25 "26" _null_ _null_ _null_ pg_get_viewdef - _null_ )); DESCR("select statement of a view"); -DATA(insert OID = 1642 ( pg_get_userbyid PGNSP PGUID 12 f f t f s 1 19 "23" _null_ _null_ _null_ pg_get_userbyid - _null_ )); -DESCR("user name by UID (with fallback)"); +DATA(insert OID = 1642 ( pg_get_userbyid PGNSP PGUID 12 f f t f s 1 19 "26" _null_ _null_ _null_ pg_get_userbyid - _null_ )); +DESCR("role name by OID (with fallback)"); DATA(insert OID = 1643 ( pg_get_indexdef PGNSP PGUID 12 f f t f s 1 25 "26" _null_ _null_ _null_ pg_get_indexdef - _null_ )); DESCR("index description"); DATA(insert OID = 1662 ( pg_get_triggerdef PGNSP PGUID 12 f f t f s 1 25 "26" _null_ _null_ _null_ pg_get_triggerdef - _null_ )); @@ -2785,10 +2785,10 @@ DATA(insert OID = 1922 ( has_table_privilege PGNSP PGUID 12 f f t f s 3 16 DESCR("user privilege on relation by username, rel name"); DATA(insert OID = 1923 ( has_table_privilege PGNSP PGUID 12 f f t f s 3 16 "19 26 25" _null_ _null_ _null_ has_table_privilege_name_id - _null_ )); DESCR("user privilege on relation by username, rel oid"); -DATA(insert OID = 1924 ( has_table_privilege PGNSP PGUID 12 f f t f s 3 16 "23 25 25" _null_ _null_ _null_ has_table_privilege_id_name - _null_ )); -DESCR("user privilege on relation by usesysid, rel name"); -DATA(insert OID = 1925 ( has_table_privilege PGNSP PGUID 12 f f t f s 3 16 "23 26 25" _null_ _null_ _null_ has_table_privilege_id_id - _null_ )); -DESCR("user privilege on relation by usesysid, rel oid"); +DATA(insert OID = 1924 ( has_table_privilege PGNSP PGUID 12 f f t f s 3 16 "26 25 25" _null_ _null_ _null_ has_table_privilege_id_name - _null_ )); +DESCR("user privilege on relation by user oid, rel name"); +DATA(insert OID = 1925 ( has_table_privilege PGNSP PGUID 12 f f t f s 3 16 "26 26 25" _null_ _null_ _null_ has_table_privilege_id_id - _null_ )); +DESCR("user privilege on relation by user oid, rel oid"); DATA(insert OID = 1926 ( has_table_privilege PGNSP PGUID 12 f f t f s 2 16 "25 25" _null_ _null_ _null_ has_table_privilege_name - _null_ )); DESCR("current user privilege on relation by rel name"); DATA(insert OID = 1927 ( has_table_privilege PGNSP PGUID 12 f f t f s 2 16 "26 25" _null_ _null_ _null_ has_table_privilege_id - _null_ )); @@ -2821,7 +2821,7 @@ DATA(insert OID = 1937 ( pg_stat_get_backend_pid PGNSP PGUID 12 f f t f s 1 23 DESCR("Statistics: PID of backend"); DATA(insert OID = 1938 ( pg_stat_get_backend_dbid PGNSP PGUID 12 f f t f s 1 26 "23" _null_ _null_ _null_ pg_stat_get_backend_dbid - _null_ )); DESCR("Statistics: Database ID of backend"); -DATA(insert OID = 1939 ( pg_stat_get_backend_userid PGNSP PGUID 12 f f t f s 1 23 "23" _null_ _null_ _null_ pg_stat_get_backend_userid - _null_ )); +DATA(insert OID = 1939 ( pg_stat_get_backend_userid PGNSP PGUID 12 f f t f s 1 26 "23" _null_ _null_ _null_ pg_stat_get_backend_userid - _null_ )); DESCR("Statistics: User ID of backend"); DATA(insert OID = 1940 ( pg_stat_get_backend_activity PGNSP PGUID 12 f f t f s 1 25 "23" _null_ _null_ _null_ pg_stat_get_backend_activity - _null_ )); DESCR("Statistics: Current query of backend"); @@ -3171,10 +3171,10 @@ DATA(insert OID = 2250 ( has_database_privilege PGNSP PGUID 12 f f t f s 3 DESCR("user privilege on database by username, database name"); DATA(insert OID = 2251 ( has_database_privilege PGNSP PGUID 12 f f t f s 3 16 "19 26 25" _null_ _null_ _null_ has_database_privilege_name_id - _null_ )); DESCR("user privilege on database by username, database oid"); -DATA(insert OID = 2252 ( has_database_privilege PGNSP PGUID 12 f f t f s 3 16 "23 25 25" _null_ _null_ _null_ has_database_privilege_id_name - _null_ )); -DESCR("user privilege on database by usesysid, database name"); -DATA(insert OID = 2253 ( has_database_privilege PGNSP PGUID 12 f f t f s 3 16 "23 26 25" _null_ _null_ _null_ has_database_privilege_id_id - _null_ )); -DESCR("user privilege on database by usesysid, database oid"); +DATA(insert OID = 2252 ( has_database_privilege PGNSP PGUID 12 f f t f s 3 16 "26 25 25" _null_ _null_ _null_ has_database_privilege_id_name - _null_ )); +DESCR("user privilege on database by user oid, database name"); +DATA(insert OID = 2253 ( has_database_privilege PGNSP PGUID 12 f f t f s 3 16 "26 26 25" _null_ _null_ _null_ has_database_privilege_id_id - _null_ )); +DESCR("user privilege on database by user oid, database oid"); DATA(insert OID = 2254 ( has_database_privilege PGNSP PGUID 12 f f t f s 2 16 "25 25" _null_ _null_ _null_ has_database_privilege_name - _null_ )); DESCR("current user privilege on database by database name"); DATA(insert OID = 2255 ( has_database_privilege PGNSP PGUID 12 f f t f s 2 16 "26 25" _null_ _null_ _null_ has_database_privilege_id - _null_ )); @@ -3184,10 +3184,10 @@ DATA(insert OID = 2256 ( has_function_privilege PGNSP PGUID 12 f f t f s 3 DESCR("user privilege on function by username, function name"); DATA(insert OID = 2257 ( has_function_privilege PGNSP PGUID 12 f f t f s 3 16 "19 26 25" _null_ _null_ _null_ has_function_privilege_name_id - _null_ )); DESCR("user privilege on function by username, function oid"); -DATA(insert OID = 2258 ( has_function_privilege PGNSP PGUID 12 f f t f s 3 16 "23 25 25" _null_ _null_ _null_ has_function_privilege_id_name - _null_ )); -DESCR("user privilege on function by usesysid, function name"); -DATA(insert OID = 2259 ( has_function_privilege PGNSP PGUID 12 f f t f s 3 16 "23 26 25" _null_ _null_ _null_ has_function_privilege_id_id - _null_ )); -DESCR("user privilege on function by usesysid, function oid"); +DATA(insert OID = 2258 ( has_function_privilege PGNSP PGUID 12 f f t f s 3 16 "26 25 25" _null_ _null_ _null_ has_function_privilege_id_name - _null_ )); +DESCR("user privilege on function by user oid, function name"); +DATA(insert OID = 2259 ( has_function_privilege PGNSP PGUID 12 f f t f s 3 16 "26 26 25" _null_ _null_ _null_ has_function_privilege_id_id - _null_ )); +DESCR("user privilege on function by user oid, function oid"); DATA(insert OID = 2260 ( has_function_privilege PGNSP PGUID 12 f f t f s 2 16 "25 25" _null_ _null_ _null_ has_function_privilege_name - _null_ )); DESCR("current user privilege on function by function name"); DATA(insert OID = 2261 ( has_function_privilege PGNSP PGUID 12 f f t f s 2 16 "26 25" _null_ _null_ _null_ has_function_privilege_id - _null_ )); @@ -3197,10 +3197,10 @@ DATA(insert OID = 2262 ( has_language_privilege PGNSP PGUID 12 f f t f s 3 DESCR("user privilege on language by username, language name"); DATA(insert OID = 2263 ( has_language_privilege PGNSP PGUID 12 f f t f s 3 16 "19 26 25" _null_ _null_ _null_ has_language_privilege_name_id - _null_ )); DESCR("user privilege on language by username, language oid"); -DATA(insert OID = 2264 ( has_language_privilege PGNSP PGUID 12 f f t f s 3 16 "23 25 25" _null_ _null_ _null_ has_language_privilege_id_name - _null_ )); -DESCR("user privilege on language by usesysid, language name"); -DATA(insert OID = 2265 ( has_language_privilege PGNSP PGUID 12 f f t f s 3 16 "23 26 25" _null_ _null_ _null_ has_language_privilege_id_id - _null_ )); -DESCR("user privilege on language by usesysid, language oid"); +DATA(insert OID = 2264 ( has_language_privilege PGNSP PGUID 12 f f t f s 3 16 "26 25 25" _null_ _null_ _null_ has_language_privilege_id_name - _null_ )); +DESCR("user privilege on language by user oid, language name"); +DATA(insert OID = 2265 ( has_language_privilege PGNSP PGUID 12 f f t f s 3 16 "26 26 25" _null_ _null_ _null_ has_language_privilege_id_id - _null_ )); +DESCR("user privilege on language by user oid, language oid"); DATA(insert OID = 2266 ( has_language_privilege PGNSP PGUID 12 f f t f s 2 16 "25 25" _null_ _null_ _null_ has_language_privilege_name - _null_ )); DESCR("current user privilege on language by language name"); DATA(insert OID = 2267 ( has_language_privilege PGNSP PGUID 12 f f t f s 2 16 "26 25" _null_ _null_ _null_ has_language_privilege_id - _null_ )); @@ -3210,10 +3210,10 @@ DATA(insert OID = 2268 ( has_schema_privilege PGNSP PGUID 12 f f t f s 3 16 DESCR("user privilege on schema by username, schema name"); DATA(insert OID = 2269 ( has_schema_privilege PGNSP PGUID 12 f f t f s 3 16 "19 26 25" _null_ _null_ _null_ has_schema_privilege_name_id - _null_ )); DESCR("user privilege on schema by username, schema oid"); -DATA(insert OID = 2270 ( has_schema_privilege PGNSP PGUID 12 f f t f s 3 16 "23 25 25" _null_ _null_ _null_ has_schema_privilege_id_name - _null_ )); -DESCR("user privilege on schema by usesysid, schema name"); -DATA(insert OID = 2271 ( has_schema_privilege PGNSP PGUID 12 f f t f s 3 16 "23 26 25" _null_ _null_ _null_ has_schema_privilege_id_id - _null_ )); -DESCR("user privilege on schema by usesysid, schema oid"); +DATA(insert OID = 2270 ( has_schema_privilege PGNSP PGUID 12 f f t f s 3 16 "26 25 25" _null_ _null_ _null_ has_schema_privilege_id_name - _null_ )); +DESCR("user privilege on schema by user oid, schema name"); +DATA(insert OID = 2271 ( has_schema_privilege PGNSP PGUID 12 f f t f s 3 16 "26 26 25" _null_ _null_ _null_ has_schema_privilege_id_id - _null_ )); +DESCR("user privilege on schema by user oid, schema oid"); DATA(insert OID = 2272 ( has_schema_privilege PGNSP PGUID 12 f f t f s 2 16 "25 25" _null_ _null_ _null_ has_schema_privilege_name - _null_ )); DESCR("current user privilege on schema by schema name"); DATA(insert OID = 2273 ( has_schema_privilege PGNSP PGUID 12 f f t f s 2 16 "26 25" _null_ _null_ _null_ has_schema_privilege_id - _null_ )); @@ -3223,10 +3223,10 @@ DATA(insert OID = 2390 ( has_tablespace_privilege PGNSP PGUID 12 f f t f s DESCR("user privilege on tablespace by username, tablespace name"); DATA(insert OID = 2391 ( has_tablespace_privilege PGNSP PGUID 12 f f t f s 3 16 "19 26 25" _null_ _null_ _null_ has_tablespace_privilege_name_id - _null_ )); DESCR("user privilege on tablespace by username, tablespace oid"); -DATA(insert OID = 2392 ( has_tablespace_privilege PGNSP PGUID 12 f f t f s 3 16 "23 25 25" _null_ _null_ _null_ has_tablespace_privilege_id_name - _null_ )); -DESCR("user privilege on tablespace by usesysid, tablespace name"); -DATA(insert OID = 2393 ( has_tablespace_privilege PGNSP PGUID 12 f f t f s 3 16 "23 26 25" _null_ _null_ _null_ has_tablespace_privilege_id_id - _null_ )); -DESCR("user privilege on tablespace by usesysid, tablespace oid"); +DATA(insert OID = 2392 ( has_tablespace_privilege PGNSP PGUID 12 f f t f s 3 16 "26 25 25" _null_ _null_ _null_ has_tablespace_privilege_id_name - _null_ )); +DESCR("user privilege on tablespace by user oid, tablespace name"); +DATA(insert OID = 2393 ( has_tablespace_privilege PGNSP PGUID 12 f f t f s 3 16 "26 26 25" _null_ _null_ _null_ has_tablespace_privilege_id_id - _null_ )); +DESCR("user privilege on tablespace by user oid, tablespace oid"); DATA(insert OID = 2394 ( has_tablespace_privilege PGNSP PGUID 12 f f t f s 2 16 "25 25" _null_ _null_ _null_ has_tablespace_privilege_name - _null_ )); DESCR("current user privilege on tablespace by tablespace name"); DATA(insert OID = 2395 ( has_tablespace_privilege PGNSP PGUID 12 f f t f s 2 16 "26 25" _null_ _null_ _null_ has_tablespace_privilege_id - _null_ )); diff --git a/src/include/catalog/pg_shadow.h b/src/include/catalog/pg_shadow.h deleted file mode 100644 index 3c24d82d450..00000000000 --- a/src/include/catalog/pg_shadow.h +++ /dev/null @@ -1,78 +0,0 @@ -/*------------------------------------------------------------------------- - * - * pg_shadow.h - * definition of the system "shadow" relation (pg_shadow) - * along with the relation's initial contents. - * - * pg_user is now a publicly accessible view on pg_shadow. - * - * - * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * $PostgreSQL: pgsql/src/include/catalog/pg_shadow.h,v 1.28 2005/04/14 01:38:21 tgl Exp $ - * - * NOTES - * the genbki.sh script reads this file and generates .bki - * information from the DATA() statements. - * - *------------------------------------------------------------------------- - */ -#ifndef PG_SHADOW_H -#define PG_SHADOW_H - - -/* ---------------- - * pg_shadow definition. cpp turns this into - * typedef struct FormData_pg_shadow - * ---------------- - */ -#define ShadowRelationId 1260 - -CATALOG(pg_shadow,1260) BKI_SHARED_RELATION BKI_WITHOUT_OIDS -{ - NameData usename; - int4 usesysid; - bool usecreatedb; - bool usesuper; /* read this field via superuser() only */ - bool usecatupd; - - /* remaining fields may be null; use heap_getattr to read them! */ - text passwd; - int4 valuntil; /* actually abstime */ - text useconfig[1]; -} FormData_pg_shadow; - -/* ---------------- - * Form_pg_shadow corresponds to a pointer to a tuple with - * the format of pg_shadow relation. - * ---------------- - */ -typedef FormData_pg_shadow *Form_pg_shadow; - -/* ---------------- - * compiler constants for pg_shadow - * ---------------- - */ -#define Natts_pg_shadow 8 -#define Anum_pg_shadow_usename 1 -#define Anum_pg_shadow_usesysid 2 -#define Anum_pg_shadow_usecreatedb 3 -#define Anum_pg_shadow_usesuper 4 -#define Anum_pg_shadow_usecatupd 5 -#define Anum_pg_shadow_passwd 6 -#define Anum_pg_shadow_valuntil 7 -#define Anum_pg_shadow_useconfig 8 - -/* ---------------- - * initial contents of pg_shadow - * - * The uppercase quantities will be replaced at initdb time with - * user choices. - * ---------------- - */ -DATA(insert ( "POSTGRES" PGUID t t t _null_ _null_ _null_ )); - -#define BOOTSTRAP_USESYSID 1 - -#endif /* PG_SHADOW_H */ diff --git a/src/include/catalog/pg_tablespace.h b/src/include/catalog/pg_tablespace.h index 7c440042746..831e5753d12 100644 --- a/src/include/catalog/pg_tablespace.h +++ b/src/include/catalog/pg_tablespace.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_tablespace.h,v 1.6 2005/04/14 01:38:21 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_tablespace.h,v 1.7 2005/06/28 05:09:12 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -36,7 +36,7 @@ CATALOG(pg_tablespace,1213) BKI_SHARED_RELATION { NameData spcname; /* tablespace name */ - int4 spcowner; /* sysid of owner */ + Oid spcowner; /* owner of tablespace */ text spclocation; /* physical location (VAR LENGTH) */ aclitem spcacl[1]; /* access permissions (VAR LENGTH) */ } FormData_pg_tablespace; diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 8a4207e9ea6..44b8cf0cedb 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.161 2005/05/30 01:20:50 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.162 2005/06/28 05:09:12 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -44,7 +44,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP { NameData typname; /* type name */ Oid typnamespace; /* OID of namespace containing this type */ - int4 typowner; /* type owner */ + Oid typowner; /* type owner */ /* * For a fixed-size type, typlen is the number of bytes we use to diff --git a/src/include/commands/conversioncmds.h b/src/include/commands/conversioncmds.h index 47224831aad..b64b361d27a 100644 --- a/src/include/commands/conversioncmds.h +++ b/src/include/commands/conversioncmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/conversioncmds.h,v 1.9 2004/12/31 22:03:28 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/commands/conversioncmds.h,v 1.10 2005/06/28 05:09:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,6 +20,6 @@ extern void CreateConversionCommand(CreateConversionStmt *parsetree); extern void DropConversionCommand(List *conversion_name, DropBehavior behavior); extern void RenameConversion(List *name, const char *newname); -extern void AlterConversionOwner(List *name, AclId newOwnerSysId); +extern void AlterConversionOwner(List *name, Oid newOwnerId); #endif /* CONVERSIONCMDS_H */ diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h index 7ffd7abeb03..1a4fd5123c2 100644 --- a/src/include/commands/dbcommands.h +++ b/src/include/commands/dbcommands.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.38 2005/06/06 17:01:25 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.39 2005/06/28 05:09:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ extern void createdb(const CreatedbStmt *stmt); extern void dropdb(const char *dbname); extern void RenameDatabase(const char *oldname, const char *newname); extern void AlterDatabaseSet(AlterDatabaseSetStmt *stmt); -extern void AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId); +extern void AlterDatabaseOwner(const char *dbname, Oid newOwnerId); extern Oid get_database_oid(const char *dbname); extern char *get_database_name(Oid dbid); diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 1ae5649c137..10c3438065a 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/defrem.h,v 1.65 2005/06/22 21:14:31 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/defrem.h,v 1.66 2005/06/28 05:09:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -50,7 +50,7 @@ extern void RemoveFunctionById(Oid funcOid); extern void SetFunctionReturnType(Oid funcOid, Oid newRetType); extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType); extern void RenameFunction(List *name, List *argtypes, const char *newname); -extern void AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId); +extern void AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId); extern void AlterFunction(AlterFunctionStmt *stmt); extern void CreateCast(CreateCastStmt *stmt); extern void DropCast(DropCastStmt *stmt); @@ -61,20 +61,20 @@ extern void DefineOperator(List *names, List *parameters); extern void RemoveOperator(RemoveOperStmt *stmt); extern void RemoveOperatorById(Oid operOid); extern void AlterOperatorOwner(List *name, TypeName *typeName1, - TypeName *typename2, AclId newOwnerSysId); + TypeName *typename2, Oid newOwnerId); /* commands/aggregatecmds.c */ extern void DefineAggregate(List *names, List *parameters); extern void RemoveAggregate(RemoveAggrStmt *stmt); extern void RenameAggregate(List *name, TypeName *basetype, const char *newname); -extern void AlterAggregateOwner(List *name, TypeName *basetype, AclId newOwnerSysId); +extern void AlterAggregateOwner(List *name, TypeName *basetype, Oid newOwnerId); /* commands/opclasscmds.c */ extern void DefineOpClass(CreateOpClassStmt *stmt); extern void RemoveOpClass(RemoveOpClassStmt *stmt); extern void RemoveOpClassById(Oid opclassOid); extern void RenameOpClass(List *name, const char *access_method, const char *newname); -extern void AlterOpClassOwner(List *name, const char *access_method, AclId newOwnerSysId); +extern void AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId); /* support routines in commands/define.c */ diff --git a/src/include/commands/schemacmds.h b/src/include/commands/schemacmds.h index 54edffa986c..4528591b3cb 100644 --- a/src/include/commands/schemacmds.h +++ b/src/include/commands/schemacmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/schemacmds.h,v 1.9 2004/12/31 22:03:28 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/commands/schemacmds.h,v 1.10 2005/06/28 05:09:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,6 +23,6 @@ extern void RemoveSchema(List *names, DropBehavior behavior); extern void RemoveSchemaById(Oid schemaOid); extern void RenameSchema(const char *oldname, const char *newname); -extern void AlterSchemaOwner(const char *name, AclId newOwnerSysId); +extern void AlterSchemaOwner(const char *name, Oid newOwnerId); #endif /* SCHEMACMDS_H */ diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h index fe99a191a33..f6c83c952b6 100644 --- a/src/include/commands/tablespace.h +++ b/src/include/commands/tablespace.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.9 2005/06/06 17:01:25 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.10 2005/06/28 05:09:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -36,7 +36,7 @@ typedef struct xl_tblspc_drop_rec extern void CreateTableSpace(CreateTableSpaceStmt *stmt); extern void DropTableSpace(DropTableSpaceStmt *stmt); extern void RenameTableSpace(const char *oldname, const char *newname); -extern void AlterTableSpaceOwner(const char *name, AclId newOwnerSysId); +extern void AlterTableSpaceOwner(const char *name, Oid newOwnerId); extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo); diff --git a/src/include/commands/typecmds.h b/src/include/commands/typecmds.h index ad5e04cc37a..a940a78f483 100644 --- a/src/include/commands/typecmds.h +++ b/src/include/commands/typecmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/typecmds.h,v 1.10 2004/12/31 22:03:28 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/commands/typecmds.h,v 1.11 2005/06/28 05:09:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -34,6 +34,6 @@ extern void AlterDomainDropConstraint(List *names, const char *constrName, extern List *GetDomainConstraints(Oid typeOid); -extern void AlterTypeOwner(List *names, AclId newOwnerSysId); +extern void AlterTypeOwner(List *names, Oid newOwnerId); #endif /* TYPECMDS_H */ diff --git a/src/include/commands/user.h b/src/include/commands/user.h index a37f94940a9..ab2829a266b 100644 --- a/src/include/commands/user.h +++ b/src/include/commands/user.h @@ -1,10 +1,10 @@ /*------------------------------------------------------------------------- * * user.h - * Commands for manipulating users and groups. + * Commands for manipulating roles (formerly called users). * * - * $PostgreSQL: pgsql/src/include/commands/user.h,v 1.26 2005/02/20 02:22:05 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/user.h,v 1.27 2005/06/28 05:09:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -14,15 +14,11 @@ #include "nodes/parsenodes.h" -extern void CreateUser(CreateUserStmt *stmt); -extern void AlterUser(AlterUserStmt *stmt); -extern void AlterUserSet(AlterUserSetStmt *stmt); -extern void DropUser(DropUserStmt *stmt); -extern void RenameUser(const char *oldname, const char *newname); - -extern void CreateGroup(CreateGroupStmt *stmt); -extern void AlterGroup(AlterGroupStmt *stmt, const char *tag); -extern void DropGroup(DropGroupStmt *stmt); -extern void RenameGroup(const char *oldname, const char *newname); +extern void CreateRole(CreateRoleStmt *stmt); +extern void AlterRole(AlterRoleStmt *stmt); +extern void AlterRoleSet(AlterRoleSetStmt *stmt); +extern void DropRole(DropRoleStmt *stmt); +extern void GrantRole(GrantRoleStmt *stmt); +extern void RenameRole(const char *oldname, const char *newname); #endif /* USER_H */ diff --git a/src/include/libpq/hba.h b/src/include/libpq/hba.h index 6798a09ad98..d170f303a43 100644 --- a/src/include/libpq/hba.h +++ b/src/include/libpq/hba.h @@ -4,7 +4,7 @@ * Interface to hba.c * * - * $PostgreSQL: pgsql/src/include/libpq/hba.h,v 1.37 2005/06/27 02:04:25 neilc Exp $ + * $PostgreSQL: pgsql/src/include/libpq/hba.h,v 1.38 2005/06/28 05:09:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -30,11 +30,10 @@ typedef enum UserAuth typedef struct Port hbaPort; -extern List **get_user_line(const char *user); +extern List **get_role_line(const char *role); extern void load_hba(void); extern void load_ident(void); -extern void load_user(void); -extern void load_group(void); +extern void load_role(void); extern int hba_getauthmethod(hbaPort *port); extern int authident(hbaPort *port); extern bool read_pg_database_line(FILE *fp, char *dbname, diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 3e9b7d912a4..8f6930cd131 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -13,7 +13,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.175 2005/02/26 18:43:34 tgl Exp $ + * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.176 2005/06/28 05:09:04 tgl Exp $ * * NOTES * some of the information in this file should be moved to other files. @@ -228,21 +228,21 @@ extern char *DatabasePath; /* now in utils/init/miscinit.c */ extern void SetDatabasePath(const char *path); -extern char *GetUserNameFromId(AclId userid); -extern AclId GetUserId(void); -extern void SetUserId(AclId userid); -extern AclId GetSessionUserId(void); -extern void SetSessionUserId(AclId userid); -extern void InitializeSessionUserId(const char *username); +extern char *GetUserNameFromId(Oid roleid); +extern Oid GetUserId(void); +extern void SetUserId(Oid roleid); +extern Oid GetSessionUserId(void); +extern void SetSessionUserId(Oid roleid); +extern void InitializeSessionUserId(const char *rolename); extern void InitializeSessionUserIdStandalone(void); -extern void SetSessionAuthorization(AclId userid, bool is_superuser); +extern void SetSessionAuthorization(Oid roleid, bool is_superuser); extern void SetDataDir(const char *dir); extern char *make_absolute_path(const char *path); /* in utils/misc/superuser.c */ extern bool superuser(void); /* current user is superuser */ -extern bool superuser_arg(AclId userid); /* given user is superuser */ +extern bool superuser_arg(Oid roleid); /* given user is superuser */ /***************************************************************************** diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index fd923f72af4..3e623911c70 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.171 2005/06/26 22:05:41 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.172 2005/06/28 05:09:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -224,6 +224,7 @@ typedef enum NodeTag T_AlterDomainStmt, T_SetOperationStmt, T_GrantStmt, + T_GrantRoleStmt, T_ClosePortalStmt, T_ClusterStmt, T_CopyStmt, @@ -261,19 +262,16 @@ typedef enum NodeTag T_DropPropertyStmt, T_CreatePLangStmt, T_DropPLangStmt, - T_CreateUserStmt, - T_AlterUserStmt, - T_DropUserStmt, + T_CreateRoleStmt, + T_AlterRoleStmt, + T_DropRoleStmt, T_LockStmt, T_ConstraintsSetStmt, - T_CreateGroupStmt, - T_AlterGroupStmt, - T_DropGroupStmt, T_ReindexStmt, T_CheckPointStmt, T_CreateSchemaStmt, T_AlterDatabaseSetStmt, - T_AlterUserSetStmt, + T_AlterRoleSetStmt, T_CreateConversionStmt, T_CreateCastStmt, T_DropCastStmt, diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index e011bb9f978..64acaa72e57 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.283 2005/06/22 21:14:31 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.284 2005/06/28 05:09:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -544,7 +544,7 @@ typedef struct RangeTblEntry bool inh; /* inheritance requested? */ bool inFromCl; /* present in FROM clause? */ AclMode requiredPerms; /* bitmask of required access permissions */ - AclId checkAsUser; /* if not zero, check access as this user */ + Oid checkAsUser; /* if valid, check access as this role */ } RangeTblEntry; /* @@ -749,12 +749,12 @@ typedef enum ObjectType OBJECT_DATABASE, OBJECT_DOMAIN, OBJECT_FUNCTION, - OBJECT_GROUP, OBJECT_INDEX, OBJECT_LANGUAGE, OBJECT_LARGEOBJECT, OBJECT_OPCLASS, OBJECT_OPERATOR, + OBJECT_ROLE, OBJECT_RULE, OBJECT_SCHEMA, OBJECT_SEQUENCE, @@ -762,7 +762,6 @@ typedef enum ObjectType OBJECT_TABLESPACE, OBJECT_TRIGGER, OBJECT_TYPE, - OBJECT_USER, OBJECT_VIEW } ObjectType; @@ -896,8 +895,7 @@ typedef struct GrantStmt typedef struct PrivGrantee { NodeTag type; - char *username; /* if both are NULL then PUBLIC */ - char *groupname; + char *rolname; /* if NULL then PUBLIC */ } PrivGrantee; /* @@ -921,6 +919,23 @@ typedef struct PrivTarget } PrivTarget; /* ---------------------- + * Grant/Revoke Role Statement + * + * Note: the lists of roles are lists of names, as Value strings + * ---------------------- + */ +typedef struct GrantRoleStmt +{ + NodeTag type; + List *granted_roles; /* list of roles to be granted/revoked */ + List *grantee_roles; /* list of member roles to add/delete */ + bool is_grant; /* true = GRANT, false = REVOKE */ + bool admin_opt; /* with admin option */ + char *grantor; /* set grantor to other than current role */ + DropBehavior behavior; /* drop behavior (for REVOKE) */ +} GrantRoleStmt; + +/* ---------------------- * Copy Statement * ---------------------- */ @@ -1123,61 +1138,37 @@ typedef struct DropPLangStmt } DropPLangStmt; /* ---------------------- - * Create/Alter/Drop User Statements + * Create/Alter/Drop Role Statements * ---------------------- */ -typedef struct CreateUserStmt +typedef struct CreateRoleStmt { NodeTag type; - char *user; /* PostgreSQL user login name */ + char *role; /* role name */ List *options; /* List of DefElem nodes */ -} CreateUserStmt; +} CreateRoleStmt; -typedef struct AlterUserStmt +typedef struct AlterRoleStmt { NodeTag type; - char *user; /* PostgreSQL user login name */ + char *role; /* role name */ List *options; /* List of DefElem nodes */ -} AlterUserStmt; + int action; /* +1 = add members, -1 = drop members */ +} AlterRoleStmt; -typedef struct AlterUserSetStmt +typedef struct AlterRoleSetStmt { NodeTag type; - char *user; - char *variable; - List *value; -} AlterUserSetStmt; + char *role; /* role name */ + char *variable; /* GUC variable name */ + List *value; /* value for variable, or NIL for Reset */ +} AlterRoleSetStmt; -typedef struct DropUserStmt +typedef struct DropRoleStmt { NodeTag type; - List *users; /* List of users to remove */ -} DropUserStmt; - -/* ---------------------- - * Create/Alter/Drop Group Statements - * ---------------------- - */ -typedef struct CreateGroupStmt -{ - NodeTag type; - char *name; /* name of the new group */ - List *options; /* List of DefElem nodes */ -} CreateGroupStmt; - -typedef struct AlterGroupStmt -{ - NodeTag type; - char *name; /* name of group to alter */ - int action; /* +1 = add, -1 = drop user */ - List *listUsers; /* list of users to add/drop */ -} AlterGroupStmt; - -typedef struct DropGroupStmt -{ - NodeTag type; - char *name; -} DropGroupStmt; + List *roles; /* List of roles to remove */ +} DropRoleStmt; /* ---------------------- * {Create|Alter} SEQUENCE Statement diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 2382ceae936..b6015f536c0 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -5,7 +5,7 @@ * * Copyright (c) 2001-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.30 2005/06/25 23:58:58 tgl Exp $ + * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.31 2005/06/28 05:09:04 tgl Exp $ * ---------- */ #ifndef PGSTAT_H @@ -101,7 +101,7 @@ typedef struct PgStat_MsgBestart { PgStat_MsgHdr m_hdr; Oid m_databaseid; - AclId m_userid; + Oid m_userid; SockAddr m_clientaddr; } PgStat_MsgBestart; diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index ac04945bcd0..f055ac93aa3 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.77 2005/01/27 23:36:14 neilc Exp $ + * $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.78 2005/06/28 05:09:13 tgl Exp $ * * NOTES * An ACL array is simply an array of AclItems, representing the union @@ -29,84 +29,64 @@ /* - * typedef AclId is declared in c.h - * * typedef AclMode is declared in parsenodes.h, also the individual privilege * bit meanings are defined there */ -#define ACL_ID_WORLD 0 /* placeholder for id in a WORLD acl item */ - -/* - * AclIdType tag that describes if the AclId is a user, group, etc. - */ -#define ACL_IDTYPE_WORLD 0x00 /* PUBLIC */ -#define ACL_IDTYPE_UID 0x01 /* user id - from pg_shadow */ -#define ACL_IDTYPE_GID 0x02 /* group id - from pg_group */ +#define ACL_ID_PUBLIC 0 /* placeholder for id in a PUBLIC acl item */ /* * AclItem * - * The IDTYPE included in ai_privs identifies the type of the grantee ID. - * The grantor ID currently must always be a user, never a group. (FIXME) - * * Note: must be same size on all platforms, because the size is hardcoded * in the pg_type.h entry for aclitem. */ typedef struct AclItem { - AclId ai_grantee; /* ID that this item grants privs to */ - AclId ai_grantor; /* grantor of privs (always a user id) */ - AclMode ai_privs; /* AclIdType plus privilege bits */ + Oid ai_grantee; /* ID that this item grants privs to */ + Oid ai_grantor; /* grantor of privs */ + AclMode ai_privs; /* privilege bits */ } AclItem; /* - * The AclIdType is stored in the top two bits of the ai_privs field - * of an AclItem. The middle 15 bits are the grant option markers, - * and the lower 15 bits are the actual privileges. We use "rights" + * The upper 16 bits of the ai_privs field of an AclItem are the grant option + * bits, and the lower 16 bits are the actual privileges. We use "rights" * to mean the combined grant option and privilege bits fields. */ -#define ACLITEM_GET_PRIVS(item) ((item).ai_privs & 0x7FFF) -#define ACLITEM_GET_GOPTIONS(item) (((item).ai_privs >> 15) & 0x7FFF) -#define ACLITEM_GET_RIGHTS(item) ((item).ai_privs & 0x3FFFFFFF) -#define ACLITEM_GET_IDTYPE(item) ((item).ai_privs >> 30) +#define ACLITEM_GET_PRIVS(item) ((item).ai_privs & 0xFFFF) +#define ACLITEM_GET_GOPTIONS(item) (((item).ai_privs >> 16) & 0xFFFF) +#define ACLITEM_GET_RIGHTS(item) ((item).ai_privs) -#define ACL_GRANT_OPTION_FOR(privs) (((AclMode) (privs) & 0x7FFF) << 15) -#define ACL_OPTION_TO_PRIVS(privs) (((AclMode) (privs) >> 15) & 0x7FFF) +#define ACL_GRANT_OPTION_FOR(privs) (((AclMode) (privs) & 0xFFFF) << 16) +#define ACL_OPTION_TO_PRIVS(privs) (((AclMode) (privs) >> 16) & 0xFFFF) #define ACLITEM_SET_PRIVS(item,privs) \ - ((item).ai_privs = ((item).ai_privs & ~((AclMode) 0x7FFF)) | \ - ((AclMode) (privs) & 0x7FFF)) + ((item).ai_privs = ((item).ai_privs & ~((AclMode) 0xFFFF)) | \ + ((AclMode) (privs) & 0xFFFF)) #define ACLITEM_SET_GOPTIONS(item,goptions) \ - ((item).ai_privs = ((item).ai_privs & ~(((AclMode) 0x7FFF) << 15)) | \ - (((AclMode) (goptions) & 0x7FFF) << 15)) + ((item).ai_privs = ((item).ai_privs & ~(((AclMode) 0xFFFF) << 16)) | \ + (((AclMode) (goptions) & 0xFFFF) << 16)) #define ACLITEM_SET_RIGHTS(item,rights) \ - ((item).ai_privs = ((item).ai_privs & ~((AclMode) 0x3FFFFFFF)) | \ - ((AclMode) (rights) & 0x3FFFFFFF)) -#define ACLITEM_SET_IDTYPE(item,idtype) \ - ((item).ai_privs = ((item).ai_privs & ~(((AclMode) 0x03) << 30)) | \ - (((AclMode) (idtype) & 0x03) << 30)) + ((item).ai_privs = (AclMode) (rights)) + +#define ACLITEM_SET_PRIVS_GOPTIONS(item,privs,goptions) \ + ((item).ai_privs = ((AclMode) (privs) & 0xFFFF) | \ + (((AclMode) (goptions) & 0xFFFF) << 16)) -#define ACLITEM_SET_PRIVS_IDTYPE(item,privs,goption,idtype) \ - ((item).ai_privs = ((AclMode) (privs) & 0x7FFF) | \ - (((AclMode) (goption) & 0x7FFF) << 15) | \ - ((AclMode) (idtype) << 30)) -#define ACLITEM_ALL_PRIV_BITS ((AclMode) 0x7FFF) -#define ACLITEM_ALL_GOPTION_BITS ((AclMode) 0x7FFF << 15) +#define ACLITEM_ALL_PRIV_BITS ((AclMode) 0xFFFF) +#define ACLITEM_ALL_GOPTION_BITS ((AclMode) 0xFFFF << 16) /* * Definitions for convenient access to Acl (array of AclItem) and IdList - * (array of AclId). These are standard PostgreSQL arrays, but are restricted + * (array of Oid). These are standard PostgreSQL arrays, but are restricted * to have one dimension. We also ignore the lower bound when reading, * and set it to one when writing. * * CAUTION: as of PostgreSQL 7.1, these arrays are toastable (just like all * other array types). Therefore, be careful to detoast them with the * macros provided, unless you know for certain that a particular array - * can't have been toasted. Presently, we do not provide toast tables for - * pg_class or pg_group, so the entries in those tables won't have been - * stored externally --- but they could have been compressed! + * can't have been toasted. */ @@ -121,13 +101,13 @@ typedef ArrayType Acl; #define ACL_SIZE(ACL) ARR_SIZE(ACL) /* - * IdList a one-dimensional array of AclId + * IdList a one-dimensional array of Oid */ typedef ArrayType IdList; #define IDLIST_NUM(IDL) (ARR_DIMS(IDL)[0]) -#define IDLIST_DAT(IDL) ((AclId *) ARR_DATA_PTR(IDL)) -#define IDLIST_N_SIZE(N) (ARR_OVERHEAD(1) + ((N) * sizeof(AclId))) +#define IDLIST_DAT(IDL) ((Oid *) ARR_DATA_PTR(IDL)) +#define IDLIST_N_SIZE(N) (ARR_OVERHEAD(1) + ((N) * sizeof(Oid))) #define IDLIST_SIZE(IDL) ARR_SIZE(IDL) /* @@ -221,14 +201,18 @@ typedef enum AclObjectKind /* * routines used internally */ -extern Acl *acldefault(GrantObjectType objtype, AclId ownerid); +extern Acl *acldefault(GrantObjectType objtype, Oid ownerId); extern Acl *aclupdate(const Acl *old_acl, const AclItem *mod_aip, - int modechg, AclId ownerid, DropBehavior behavior); -extern Acl *aclnewowner(const Acl *old_acl, AclId oldownerid, AclId newownerid); + int modechg, Oid ownerId, DropBehavior behavior); +extern Acl *aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId); -extern AclMode aclmask(const Acl *acl, AclId userid, AclId ownerid, +extern AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId, AclMode mask, AclMaskHow how); +extern bool is_member_of_role(Oid member, Oid role); + +extern void InitializeAcl(void); + /* * SQL functions (from acl.c) */ @@ -245,40 +229,39 @@ extern Datum hash_aclitem(PG_FUNCTION_ARGS); * prototypes for functions in aclchk.c */ extern void ExecuteGrantStmt(GrantStmt *stmt); -extern char *get_groname(AclId grosysid); -extern AclMode pg_class_aclmask(Oid table_oid, AclId userid, +extern AclMode pg_class_aclmask(Oid table_oid, Oid roleid, AclMode mask, AclMaskHow how); -extern AclMode pg_database_aclmask(Oid db_oid, AclId userid, +extern AclMode pg_database_aclmask(Oid db_oid, Oid roleid, AclMode mask, AclMaskHow how); -extern AclMode pg_proc_aclmask(Oid proc_oid, AclId userid, +extern AclMode pg_proc_aclmask(Oid proc_oid, Oid roleid, AclMode mask, AclMaskHow how); -extern AclMode pg_language_aclmask(Oid lang_oid, AclId userid, +extern AclMode pg_language_aclmask(Oid lang_oid, Oid roleid, AclMode mask, AclMaskHow how); -extern AclMode pg_namespace_aclmask(Oid nsp_oid, AclId userid, +extern AclMode pg_namespace_aclmask(Oid nsp_oid, Oid roleid, AclMode mask, AclMaskHow how); -extern AclMode pg_tablespace_aclmask(Oid spc_oid, AclId userid, +extern AclMode pg_tablespace_aclmask(Oid spc_oid, Oid roleid, AclMode mask, AclMaskHow how); -extern AclResult pg_class_aclcheck(Oid table_oid, AclId userid, AclMode mode); -extern AclResult pg_database_aclcheck(Oid db_oid, AclId userid, AclMode mode); -extern AclResult pg_proc_aclcheck(Oid proc_oid, AclId userid, AclMode mode); -extern AclResult pg_language_aclcheck(Oid lang_oid, AclId userid, AclMode mode); -extern AclResult pg_namespace_aclcheck(Oid nsp_oid, AclId userid, AclMode mode); -extern AclResult pg_tablespace_aclcheck(Oid spc_oid, AclId userid, AclMode mode); +extern AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode); +extern AclResult pg_database_aclcheck(Oid db_oid, Oid roleid, AclMode mode); +extern AclResult pg_proc_aclcheck(Oid proc_oid, Oid roleid, AclMode mode); +extern AclResult pg_language_aclcheck(Oid lang_oid, Oid roleid, AclMode mode); +extern AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid roleid, AclMode mode); +extern AclResult pg_tablespace_aclcheck(Oid spc_oid, Oid roleid, AclMode mode); extern void aclcheck_error(AclResult aclerr, AclObjectKind objectkind, const char *objectname); /* ownercheck routines just return true (owner) or false (not) */ -extern bool pg_class_ownercheck(Oid class_oid, AclId userid); -extern bool pg_type_ownercheck(Oid type_oid, AclId userid); -extern bool pg_oper_ownercheck(Oid oper_oid, AclId userid); -extern bool pg_proc_ownercheck(Oid proc_oid, AclId userid); -extern bool pg_namespace_ownercheck(Oid nsp_oid, AclId userid); -extern bool pg_tablespace_ownercheck(Oid spc_oid, AclId userid); -extern bool pg_opclass_ownercheck(Oid opc_oid, AclId userid); -extern bool pg_database_ownercheck(Oid db_oid, AclId userid); -extern bool pg_conversion_ownercheck(Oid conv_oid, AclId userid); +extern bool pg_class_ownercheck(Oid class_oid, Oid roleid); +extern bool pg_type_ownercheck(Oid type_oid, Oid roleid); +extern bool pg_oper_ownercheck(Oid oper_oid, Oid roleid); +extern bool pg_proc_ownercheck(Oid proc_oid, Oid roleid); +extern bool pg_namespace_ownercheck(Oid nsp_oid, Oid roleid); +extern bool pg_tablespace_ownercheck(Oid spc_oid, Oid roleid); +extern bool pg_opclass_ownercheck(Oid opc_oid, Oid roleid); +extern bool pg_database_ownercheck(Oid db_oid, Oid roleid); +extern bool pg_conversion_ownercheck(Oid conv_oid, Oid roleid); #endif /* ACL_H */ diff --git a/src/include/utils/flatfiles.h b/src/include/utils/flatfiles.h index 939239aa1b9..5faf35db57b 100644 --- a/src/include/utils/flatfiles.h +++ b/src/include/utils/flatfiles.h @@ -4,7 +4,7 @@ * Routines for maintaining "flat file" images of the shared catalogs. * * - * $PostgreSQL: pgsql/src/include/utils/flatfiles.h,v 1.4 2005/06/17 22:32:50 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/flatfiles.h,v 1.5 2005/06/28 05:09:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -14,12 +14,10 @@ #include "fmgr.h" extern void database_file_update_needed(void); -extern void group_file_update_needed(void); -extern void user_file_update_needed(void); +extern void auth_file_update_needed(void); extern char *database_getflatfilename(void); -extern char *group_getflatfilename(void); -extern char *user_getflatfilename(void); +extern char *auth_getflatfilename(void); extern void BuildFlatFiles(bool database_only); diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index b0967edca57..dfd785d5d10 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.99 2005/05/01 18:56:19 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.100 2005/06/28 05:09:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -104,8 +104,8 @@ extern void free_attstatsslot(Oid atttype, Datum *values, int nvalues, float4 *numbers, int nnumbers); extern char *get_namespace_name(Oid nspid); -extern AclId get_usesysid(const char *username); -extern AclId get_grosysid(char *groname); +extern Oid get_roleid(const char *rolname); +extern Oid get_roleid_checked(const char *rolname); #define is_array_type(typid) (get_element_type(typid) != InvalidOid) diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h index 976788f4057..8a30e08e184 100644 --- a/src/include/utils/syscache.h +++ b/src/include/utils/syscache.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.59 2005/03/29 00:17:18 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/syscache.h,v 1.60 2005/06/28 05:09:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -36,29 +36,29 @@ #define AMPROCNUM 5 #define ATTNAME 6 #define ATTNUM 7 -#define CASTSOURCETARGET 8 -#define CLAAMNAMENSP 9 -#define CLAOID 10 -#define CONDEFAULT 11 -#define CONNAMENSP 12 -#define CONOID 13 -#define GRONAME 14 -#define GROSYSID 15 -#define INDEXRELID 16 -#define INHRELID 17 -#define LANGNAME 18 -#define LANGOID 19 -#define NAMESPACENAME 20 -#define NAMESPACEOID 21 -#define OPERNAMENSP 22 -#define OPEROID 23 -#define PROCNAMEARGSNSP 24 -#define PROCOID 25 -#define RELNAMENSP 26 -#define RELOID 27 -#define RULERELNAME 28 -#define SHADOWNAME 29 -#define SHADOWSYSID 30 +#define AUTHMEMMEMROLE 8 +#define AUTHMEMROLEMEM 9 +#define AUTHNAME 10 +#define AUTHOID 11 +#define CASTSOURCETARGET 12 +#define CLAAMNAMENSP 13 +#define CLAOID 14 +#define CONDEFAULT 15 +#define CONNAMENSP 16 +#define CONOID 17 +#define INDEXRELID 18 +#define INHRELID 19 +#define LANGNAME 20 +#define LANGOID 21 +#define NAMESPACENAME 22 +#define NAMESPACEOID 23 +#define OPERNAMENSP 24 +#define OPEROID 25 +#define PROCNAMEARGSNSP 26 +#define PROCOID 27 +#define RELNAMENSP 28 +#define RELOID 29 +#define RULERELNAME 30 #define STATRELATT 31 #define TYPENAMENSP 32 #define TYPEOID 33 |