Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7762619

Browse files
committed
Replace pg_shadow and pg_group by new role-capable catalogs pg_authid
and pg_auth_members. There are still many loose ends to finish in this patch (no documentation, no regression tests, no pg_dump support for instance). But I'm going to commit it now anyway so that Alvaro can make some progress on shared dependencies. The catalog changes should be pretty much done.
1 parent 977530d commit 7762619

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+3334
-3236
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 530 additions & 230 deletions
Large diffs are not rendered by default.

doc/src/sgml/func.sgml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.260 2005/06/26 22:05:35 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.261 2005/06/28 05:08:50 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -8443,8 +8443,8 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
84438443
<para>
84448444
<function>has_table_privilege</function> checks whether a user
84458445
can access a table in a particular way. The user can be
8446-
specified by name or by ID
8447-
(<literal>pg_user.usesysid</literal>), or if the argument is
8446+
specified by name or by OID
8447+
(<literal>pg_authid.oid</literal>), or if the argument is
84488448
omitted
84498449
<function>current_user</function> is assumed. The table can be specified
84508450
by name or by OID. (Thus, there are actually six variants of
@@ -8756,9 +8756,9 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
87568756
in it refer to the relation indicated by the second parameter</entry>
87578757
</row>
87588758
<row>
8759-
<entry><literal><function>pg_get_userbyid</function>(<parameter>userid</parameter>)</literal></entry>
8759+
<entry><literal><function>pg_get_userbyid</function>(<parameter>roleid</parameter>)</literal></entry>
87608760
<entry><type>name</type></entry>
8761-
<entry>get user name with given ID</entry>
8761+
<entry>get role name with given ID</entry>
87628762
</row>
87638763
<row>
87648764
<entry><literal><function>pg_get_serial_sequence</function>(<parameter>table_name</parameter>, <parameter>column_name</parameter>)</literal></entry>
@@ -8805,7 +8805,7 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
88058805

88068806
<para>
88078807
<function>pg_get_userbyid</function>
8808-
extracts a user's name given a user ID number.
8808+
extracts a role's name given its OID.
88098809
<function>pg_get_serial_sequence</function>
88108810
fetches the name of the sequence associated with a serial or
88118811
bigserial column. The name is suitably formatted

src/backend/access/transam/twophase.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.6 2005/06/19 22:34:56 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.7 2005/06/28 05:08:51 tgl Exp $
1111
*
1212
* NOTES
1313
* Each global transaction is associated with a global transaction
@@ -107,7 +107,7 @@ typedef struct GlobalTransactionData
107107
PGPROC proc; /* dummy proc */
108108
TimestampTz prepared_at; /* time of preparation */
109109
XLogRecPtr prepare_lsn; /* XLOG offset of prepare record */
110-
AclId owner; /* ID of user that executed the xact */
110+
Oid owner; /* ID of user that executed the xact */
111111
TransactionId locking_xid; /* top-level XID of backend working on xact */
112112
bool valid; /* TRUE if fully prepared */
113113
char gid[GIDSIZE]; /* The GID assigned to the prepared xact */
@@ -206,7 +206,7 @@ TwoPhaseShmemInit(void)
206206
*/
207207
GlobalTransaction
208208
MarkAsPreparing(TransactionId xid, const char *gid,
209-
TimestampTz prepared_at, AclId owner, Oid databaseid)
209+
TimestampTz prepared_at, Oid owner, Oid databaseid)
210210
{
211211
GlobalTransaction gxact;
212212
int i;
@@ -350,7 +350,7 @@ MarkAsPrepared(GlobalTransaction gxact)
350350
* Locate the prepared transaction and mark it busy for COMMIT or PREPARE.
351351
*/
352352
static GlobalTransaction
353-
LockGXact(const char *gid, AclId user)
353+
LockGXact(const char *gid, Oid user)
354354
{
355355
int i;
356356

@@ -559,7 +559,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS)
559559
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "prepared",
560560
TIMESTAMPTZOID, -1, 0);
561561
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "ownerid",
562-
INT4OID, -1, 0);
562+
OIDOID, -1, 0);
563563
TupleDescInitEntry(tupdesc, (AttrNumber) 5, "dbid",
564564
OIDOID, -1, 0);
565565

@@ -601,7 +601,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS)
601601
values[0] = TransactionIdGetDatum(gxact->proc.xid);
602602
values[1] = DirectFunctionCall1(textin, CStringGetDatum(gxact->gid));
603603
values[2] = TimestampTzGetDatum(gxact->prepared_at);
604-
values[3] = Int32GetDatum(gxact->owner);
604+
values[3] = ObjectIdGetDatum(gxact->owner);
605605
values[4] = ObjectIdGetDatum(gxact->proc.databaseId);
606606

607607
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
@@ -690,7 +690,7 @@ typedef struct TwoPhaseFileHeader
690690
TransactionId xid; /* original transaction XID */
691691
Oid database; /* OID of database it was in */
692692
TimestampTz prepared_at; /* time of preparation */
693-
AclId owner; /* user running the transaction */
693+
Oid owner; /* user running the transaction */
694694
int32 nsubxacts; /* number of following subxact XIDs */
695695
int32 ncommitrels; /* number of delete-on-commit rels */
696696
int32 nabortrels; /* number of delete-on-abort rels */

src/backend/access/transam/xact.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.207 2005/06/19 20:00:38 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.208 2005/06/28 05:08:51 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -121,7 +121,7 @@ typedef struct TransactionStateData
121121
* context */
122122
ResourceOwner curTransactionOwner; /* my query resources */
123123
List *childXids; /* subcommitted child XIDs */
124-
AclId currentUser; /* subxact start current_user */
124+
Oid currentUser; /* subxact start current_user */
125125
bool prevXactReadOnly; /* entry-time xact r/o state */
126126
struct TransactionStateData *parent; /* back link to parent */
127127
} TransactionStateData;
@@ -1488,8 +1488,10 @@ CommitTransaction(void)
14881488
/* NOTIFY commit must come before lower-level cleanup */
14891489
AtCommit_Notify();
14901490

1491-
/* Update flat files if we changed pg_database, pg_shadow or pg_group */
1492-
/* This should be the last step before commit */
1491+
/*
1492+
* Update flat files if we changed pg_database, pg_authid or
1493+
* pg_auth_members. This should be the last step before commit.
1494+
*/
14931495
AtEOXact_UpdateFlatFiles(true);
14941496

14951497
/* Prevent cancel/die interrupt while cleaning up */
@@ -3847,7 +3849,7 @@ PushTransaction(void)
38473849
{
38483850
TransactionState p = CurrentTransactionState;
38493851
TransactionState s;
3850-
AclId currentUser;
3852+
Oid currentUser;
38513853

38523854
/*
38533855
* At present, GetUserId cannot fail, but let's not assume that. Get

src/backend/catalog/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for backend/catalog
44
#
5-
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.53 2004/07/21 20:34:45 momjian Exp $
5+
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.54 2005/06/28 05:08:52 tgl Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -31,8 +31,9 @@ POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\
3131
pg_operator.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \
3232
pg_language.h pg_largeobject.h pg_aggregate.h pg_statistic.h \
3333
pg_rewrite.h pg_trigger.h pg_listener.h pg_description.h pg_cast.h \
34-
pg_namespace.h pg_conversion.h pg_database.h pg_shadow.h pg_group.h \
35-
pg_tablespace.h pg_depend.h indexing.h \
34+
pg_namespace.h pg_conversion.h pg_database.h \
35+
pg_authid.h pg_auth_members.h pg_tablespace.h pg_depend.h \
36+
indexing.h \
3637
)
3738

3839
pg_includes := $(sort -I$(top_srcdir)/src/include -I$(top_builddir)/src/include)

0 commit comments

Comments
 (0)