Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 93902e9

Browse files
committed
Make usesysid consistently int4, not oid.
Catalog patch from Alvaro Herrera for same. catversion updated. initdb required.
1 parent 91f508a commit 93902e9

File tree

11 files changed

+45
-42
lines changed

11 files changed

+45
-42
lines changed

src/backend/catalog/aclchk.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.78 2002/09/24 23:14:25 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.79 2002/12/04 05:18:31 momjian Exp $
1212
*
1313
* NOTES
1414
* See acl.h.
@@ -893,7 +893,7 @@ aclcheck_error(AclResult errcode, const char *objectname)
893893
* Exported routine for checking a user's access privileges to a table
894894
*/
895895
AclResult
896-
pg_class_aclcheck(Oid table_oid, Oid userid, AclMode mode)
896+
pg_class_aclcheck(Oid table_oid, AclId userid, AclMode mode)
897897
{
898898
AclResult result;
899899
bool usesuper,
@@ -991,7 +991,7 @@ pg_class_aclcheck(Oid table_oid, Oid userid, AclMode mode)
991991
* Exported routine for checking a user's access privileges to a database
992992
*/
993993
AclResult
994-
pg_database_aclcheck(Oid db_oid, Oid userid, AclMode mode)
994+
pg_database_aclcheck(Oid db_oid, AclId userid, AclMode mode)
995995
{
996996
AclResult result;
997997
Relation pg_database;
@@ -1054,7 +1054,7 @@ pg_database_aclcheck(Oid db_oid, Oid userid, AclMode mode)
10541054
* Exported routine for checking a user's access privileges to a function
10551055
*/
10561056
AclResult
1057-
pg_proc_aclcheck(Oid proc_oid, Oid userid, AclMode mode)
1057+
pg_proc_aclcheck(Oid proc_oid, AclId userid, AclMode mode)
10581058
{
10591059
AclResult result;
10601060
HeapTuple tuple;
@@ -1107,7 +1107,7 @@ pg_proc_aclcheck(Oid proc_oid, Oid userid, AclMode mode)
11071107
* Exported routine for checking a user's access privileges to a language
11081108
*/
11091109
AclResult
1110-
pg_language_aclcheck(Oid lang_oid, Oid userid, AclMode mode)
1110+
pg_language_aclcheck(Oid lang_oid, AclId userid, AclMode mode)
11111111
{
11121112
AclResult result;
11131113
HeapTuple tuple;
@@ -1157,7 +1157,7 @@ pg_language_aclcheck(Oid lang_oid, Oid userid, AclMode mode)
11571157
* Exported routine for checking a user's access privileges to a namespace
11581158
*/
11591159
AclResult
1160-
pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode)
1160+
pg_namespace_aclcheck(Oid nsp_oid, AclId userid, AclMode mode)
11611161
{
11621162
AclResult result;
11631163
HeapTuple tuple;
@@ -1218,7 +1218,7 @@ pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode)
12181218
* Ownership check for a relation (specified by OID).
12191219
*/
12201220
bool
1221-
pg_class_ownercheck(Oid class_oid, Oid userid)
1221+
pg_class_ownercheck(Oid class_oid, AclId userid)
12221222
{
12231223
HeapTuple tuple;
12241224
AclId owner_id;
@@ -1244,7 +1244,7 @@ pg_class_ownercheck(Oid class_oid, Oid userid)
12441244
* Ownership check for a type (specified by OID).
12451245
*/
12461246
bool
1247-
pg_type_ownercheck(Oid type_oid, Oid userid)
1247+
pg_type_ownercheck(Oid type_oid, AclId userid)
12481248
{
12491249
HeapTuple tuple;
12501250
AclId owner_id;
@@ -1270,7 +1270,7 @@ pg_type_ownercheck(Oid type_oid, Oid userid)
12701270
* Ownership check for an operator (specified by OID).
12711271
*/
12721272
bool
1273-
pg_oper_ownercheck(Oid oper_oid, Oid userid)
1273+
pg_oper_ownercheck(Oid oper_oid, AclId userid)
12741274
{
12751275
HeapTuple tuple;
12761276
AclId owner_id;
@@ -1296,7 +1296,7 @@ pg_oper_ownercheck(Oid oper_oid, Oid userid)
12961296
* Ownership check for a function (specified by OID).
12971297
*/
12981298
bool
1299-
pg_proc_ownercheck(Oid proc_oid, Oid userid)
1299+
pg_proc_ownercheck(Oid proc_oid, AclId userid)
13001300
{
13011301
HeapTuple tuple;
13021302
AclId owner_id;
@@ -1322,7 +1322,7 @@ pg_proc_ownercheck(Oid proc_oid, Oid userid)
13221322
* Ownership check for a namespace (specified by OID).
13231323
*/
13241324
bool
1325-
pg_namespace_ownercheck(Oid nsp_oid, Oid userid)
1325+
pg_namespace_ownercheck(Oid nsp_oid, AclId userid)
13261326
{
13271327
HeapTuple tuple;
13281328
AclId owner_id;
@@ -1349,7 +1349,7 @@ pg_namespace_ownercheck(Oid nsp_oid, Oid userid)
13491349
* Ownership check for an operator class (specified by OID).
13501350
*/
13511351
bool
1352-
pg_opclass_ownercheck(Oid opc_oid, Oid userid)
1352+
pg_opclass_ownercheck(Oid opc_oid, AclId userid)
13531353
{
13541354
HeapTuple tuple;
13551355
AclId owner_id;

src/backend/catalog/namespace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
1515
* IDENTIFICATION
16-
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.40 2002/11/11 22:19:21 tgl Exp $
16+
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.41 2002/12/04 05:18:31 momjian Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -1365,7 +1365,7 @@ FindDefaultConversionProc(int4 for_encoding, int4 to_encoding)
13651365
static void
13661366
recomputeNamespacePath(void)
13671367
{
1368-
Oid userId = GetUserId();
1368+
AclId userId = GetUserId();
13691369
char *rawname;
13701370
List *namelist;
13711371
List *oidlist;

src/backend/catalog/pg_conversion.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_conversion.c,v 1.8 2002/11/02 18:41:21 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_conversion.c,v 1.9 2002/12/04 05:18:32 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -37,7 +37,7 @@
3737
*/
3838
Oid
3939
ConversionCreate(const char *conname, Oid connamespace,
40-
int32 conowner,
40+
AclId conowner,
4141
int32 conforencoding, int32 contoencoding,
4242
Oid conproc, bool def)
4343
{

src/backend/commands/cluster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.97 2002/11/23 18:26:45 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.98 2002/12/04 05:18:33 momjian Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -804,11 +804,11 @@ check_cluster_ownership(Oid relOid)
804804

805805
/* Get a list of tables that the current user owns and
806806
* have indisclustered set. Return the list in a List * of rvsToCluster
807-
* with the tableOid and the indexOid on which the table is already
807+
* with the tableOid and the indexOid on which the table is already
808808
* clustered.
809809
*/
810810
List *
811-
get_tables_to_cluster(Oid owner)
811+
get_tables_to_cluster(AclId owner)
812812
{
813813
Relation indRelation;
814814
HeapScanDesc scan;

src/backend/utils/adt/pgstatfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ pg_stat_get_backend_userid(PG_FUNCTION_ARGS)
272272
if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
273273
PG_RETURN_NULL();
274274

275-
PG_RETURN_OID(beentry->userid);
275+
PG_RETURN_INT32(beentry->userid);
276276
}
277277

278278

src/include/catalog/catversion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
3838
* Portions Copyright (c) 1994, Regents of the University of California
3939
*
40-
* $Id: catversion.h,v 1.166 2002/11/25 18:12:11 tgl Exp $
40+
* $Id: catversion.h,v 1.167 2002/12/04 05:18:35 momjian Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 200211251
56+
#define CATALOG_VERSION_NO 200212031
5757

5858
#endif

src/include/catalog/pg_conversion.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $Id: pg_conversion.h,v 1.7 2002/11/02 02:33:03 tgl Exp $
11+
* $Id: pg_conversion.h,v 1.8 2002/12/04 05:18:35 momjian Exp $
1212
*
1313
* NOTES
1414
* the genbki.sh script reads this file and generates .bki
@@ -19,6 +19,8 @@
1919
#ifndef PG_CONVERSION_H
2020
#define PG_CONVERSION_H
2121

22+
#include "miscadmin.h"
23+
2224
/* ----------------
2325
* postgres.h contains the system type definitions and the
2426
* CATALOG(), BOOTSTRAP and DATA() sugar words so this file
@@ -84,7 +86,7 @@ typedef FormData_pg_conversion *Form_pg_conversion;
8486
#include "nodes/parsenodes.h"
8587

8688
extern Oid ConversionCreate(const char *conname, Oid connamespace,
87-
int32 conowner,
89+
AclId conowner,
8890
int32 conforencoding, int32 contoencoding,
8991
Oid conproc, bool def);
9092
extern void ConversionDrop(Oid conversionOid, DropBehavior behavior);

src/include/catalog/pg_proc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_proc.h,v 1.276 2002/11/08 17:27:03 momjian Exp $
10+
* $Id: pg_proc.h,v 1.277 2002/12/04 05:18:36 momjian Exp $
1111
*
1212
* NOTES
1313
* The script catalog/genbki.sh reads this file and generates .bki
@@ -2738,7 +2738,7 @@ DATA(insert OID = 1937 ( pg_stat_get_backend_pid PGNSP PGUID 12 f f t f s 1 23
27382738
DESCR("Statistics: PID of backend");
27392739
DATA(insert OID = 1938 ( pg_stat_get_backend_dbid PGNSP PGUID 12 f f t f s 1 26 "23" pg_stat_get_backend_dbid - _null_ ));
27402740
DESCR("Statistics: Database ID of backend");
2741-
DATA(insert OID = 1939 ( pg_stat_get_backend_userid PGNSP PGUID 12 f f t f s 1 26 "23" pg_stat_get_backend_userid - _null_ ));
2741+
DATA(insert OID = 1939 ( pg_stat_get_backend_userid PGNSP PGUID 12 f f t f s 1 23 "23" pg_stat_get_backend_userid - _null_ ));
27422742
DESCR("Statistics: User ID of backend");
27432743
DATA(insert OID = 1940 ( pg_stat_get_backend_activity PGNSP PGUID 12 f f t f s 1 25 "23" pg_stat_get_backend_activity - _null_ ));
27442744
DESCR("Statistics: Current query of backend");

src/include/miscadmin.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: miscadmin.h,v 1.111 2002/10/03 17:07:53 momjian Exp $
15+
* $Id: miscadmin.h,v 1.112 2002/12/04 05:18:34 momjian Exp $
1616
*
1717
* NOTES
1818
* some of the information in this file should be moved to
@@ -202,7 +202,13 @@ extern void SetDatabasePath(const char *path);
202202

203203
extern char *GetUserNameFromId(Oid userid);
204204

205-
extern Oid GetUserId(void);
205+
/*
206+
* AclId system identifier for the user, group, etc.
207+
* XXX Perhaps replace this type by OID?
208+
*/
209+
typedef uint32 AclId;
210+
211+
extern AclId GetUserId(void);
206212
extern void SetUserId(Oid userid);
207213
extern Oid GetSessionUserId(void);
208214
extern void SetSessionUserId(Oid userid);

src/include/utils/acl.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: acl.h,v 1.47 2002/09/04 20:31:45 momjian Exp $
10+
* $Id: acl.h,v 1.48 2002/12/04 05:18:38 momjian Exp $
1111
*
1212
* NOTES
1313
* For backward-compatibility purposes we have to allow there
@@ -22,16 +22,11 @@
2222
#ifndef ACL_H
2323
#define ACL_H
2424

25+
#include "miscadmin.h"
2526
#include "nodes/parsenodes.h"
2627
#include "utils/array.h"
2728

2829

29-
/*
30-
* AclId system identifier for the user, group, etc.
31-
* XXX Perhaps replace this type by OID?
32-
*/
33-
typedef uint32 AclId;
34-
3530
#define ACL_ID_WORLD 0 /* placeholder for id in a WORLD acl item */
3631

3732
/*
@@ -204,11 +199,11 @@ extern AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode);
204199
extern void aclcheck_error(AclResult errcode, const char *objectname);
205200

206201
/* ownercheck routines just return true (owner) or false (not) */
207-
extern bool pg_class_ownercheck(Oid class_oid, Oid userid);
208-
extern bool pg_type_ownercheck(Oid type_oid, Oid userid);
209-
extern bool pg_oper_ownercheck(Oid oper_oid, Oid userid);
210-
extern bool pg_proc_ownercheck(Oid proc_oid, Oid userid);
211-
extern bool pg_namespace_ownercheck(Oid nsp_oid, Oid userid);
212-
extern bool pg_opclass_ownercheck(Oid opc_oid, Oid userid);
202+
extern bool pg_class_ownercheck(Oid class_oid, AclId userid);
203+
extern bool pg_type_ownercheck(Oid type_oid, AclId userid);
204+
extern bool pg_oper_ownercheck(Oid oper_oid, AclId userid);
205+
extern bool pg_proc_ownercheck(Oid proc_oid, AclId userid);
206+
extern bool pg_namespace_ownercheck(Oid nsp_oid, AclId userid);
207+
extern bool pg_opclass_ownercheck(Oid opc_oid, AclId userid);
213208

214209
#endif /* ACL_H */

0 commit comments

Comments
 (0)