Make usesysid consistently int4, not oid.

Catalog patch from Alvaro Herrera for same.

catversion updated. initdb required.
This commit is contained in:
Bruce Momjian 2002-12-04 05:18:38 +00:00
parent 91f508ae85
commit 93902e9521
11 changed files with 45 additions and 42 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.78 2002/09/24 23:14:25 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.79 2002/12/04 05:18:31 momjian Exp $
*
* NOTES
* See acl.h.
@ -893,7 +893,7 @@ aclcheck_error(AclResult errcode, const char *objectname)
* Exported routine for checking a user's access privileges to a table
*/
AclResult
pg_class_aclcheck(Oid table_oid, Oid userid, AclMode mode)
pg_class_aclcheck(Oid table_oid, AclId userid, AclMode mode)
{
AclResult result;
bool usesuper,
@ -991,7 +991,7 @@ pg_class_aclcheck(Oid table_oid, Oid userid, AclMode mode)
* Exported routine for checking a user's access privileges to a database
*/
AclResult
pg_database_aclcheck(Oid db_oid, Oid userid, AclMode mode)
pg_database_aclcheck(Oid db_oid, AclId userid, AclMode mode)
{
AclResult result;
Relation pg_database;
@ -1054,7 +1054,7 @@ pg_database_aclcheck(Oid db_oid, Oid userid, AclMode mode)
* Exported routine for checking a user's access privileges to a function
*/
AclResult
pg_proc_aclcheck(Oid proc_oid, Oid userid, AclMode mode)
pg_proc_aclcheck(Oid proc_oid, AclId userid, AclMode mode)
{
AclResult result;
HeapTuple tuple;
@ -1107,7 +1107,7 @@ pg_proc_aclcheck(Oid proc_oid, Oid userid, AclMode mode)
* Exported routine for checking a user's access privileges to a language
*/
AclResult
pg_language_aclcheck(Oid lang_oid, Oid userid, AclMode mode)
pg_language_aclcheck(Oid lang_oid, AclId userid, AclMode mode)
{
AclResult result;
HeapTuple tuple;
@ -1157,7 +1157,7 @@ pg_language_aclcheck(Oid lang_oid, Oid userid, AclMode mode)
* Exported routine for checking a user's access privileges to a namespace
*/
AclResult
pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode)
pg_namespace_aclcheck(Oid nsp_oid, AclId userid, AclMode mode)
{
AclResult result;
HeapTuple tuple;
@ -1218,7 +1218,7 @@ pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode)
* Ownership check for a relation (specified by OID).
*/
bool
pg_class_ownercheck(Oid class_oid, Oid userid)
pg_class_ownercheck(Oid class_oid, AclId userid)
{
HeapTuple tuple;
AclId owner_id;
@ -1244,7 +1244,7 @@ pg_class_ownercheck(Oid class_oid, Oid userid)
* Ownership check for a type (specified by OID).
*/
bool
pg_type_ownercheck(Oid type_oid, Oid userid)
pg_type_ownercheck(Oid type_oid, AclId userid)
{
HeapTuple tuple;
AclId owner_id;
@ -1270,7 +1270,7 @@ pg_type_ownercheck(Oid type_oid, Oid userid)
* Ownership check for an operator (specified by OID).
*/
bool
pg_oper_ownercheck(Oid oper_oid, Oid userid)
pg_oper_ownercheck(Oid oper_oid, AclId userid)
{
HeapTuple tuple;
AclId owner_id;
@ -1296,7 +1296,7 @@ pg_oper_ownercheck(Oid oper_oid, Oid userid)
* Ownership check for a function (specified by OID).
*/
bool
pg_proc_ownercheck(Oid proc_oid, Oid userid)
pg_proc_ownercheck(Oid proc_oid, AclId userid)
{
HeapTuple tuple;
AclId owner_id;
@ -1322,7 +1322,7 @@ pg_proc_ownercheck(Oid proc_oid, Oid userid)
* Ownership check for a namespace (specified by OID).
*/
bool
pg_namespace_ownercheck(Oid nsp_oid, Oid userid)
pg_namespace_ownercheck(Oid nsp_oid, AclId userid)
{
HeapTuple tuple;
AclId owner_id;
@ -1349,7 +1349,7 @@ pg_namespace_ownercheck(Oid nsp_oid, Oid userid)
* Ownership check for an operator class (specified by OID).
*/
bool
pg_opclass_ownercheck(Oid opc_oid, Oid userid)
pg_opclass_ownercheck(Oid opc_oid, AclId userid)
{
HeapTuple tuple;
AclId owner_id;

View File

@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.40 2002/11/11 22:19:21 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.41 2002/12/04 05:18:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -1365,7 +1365,7 @@ FindDefaultConversionProc(int4 for_encoding, int4 to_encoding)
static void
recomputeNamespacePath(void)
{
Oid userId = GetUserId();
AclId userId = GetUserId();
char *rawname;
List *namelist;
List *oidlist;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_conversion.c,v 1.8 2002/11/02 18:41:21 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_conversion.c,v 1.9 2002/12/04 05:18:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -37,7 +37,7 @@
*/
Oid
ConversionCreate(const char *conname, Oid connamespace,
int32 conowner,
AclId conowner,
int32 conforencoding, int32 contoencoding,
Oid conproc, bool def)
{

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.97 2002/11/23 18:26:45 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.98 2002/12/04 05:18:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -804,11 +804,11 @@ check_cluster_ownership(Oid relOid)
/* Get a list of tables that the current user owns and
* have indisclustered set. Return the list in a List * of rvsToCluster
* with the tableOid and the indexOid on which the table is already
* with the tableOid and the indexOid on which the table is already
* clustered.
*/
List *
get_tables_to_cluster(Oid owner)
get_tables_to_cluster(AclId owner)
{
Relation indRelation;
HeapScanDesc scan;

View File

@ -272,7 +272,7 @@ pg_stat_get_backend_userid(PG_FUNCTION_ARGS)
if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
PG_RETURN_NULL();
PG_RETURN_OID(beentry->userid);
PG_RETURN_INT32(beentry->userid);
}

View File

@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catversion.h,v 1.166 2002/11/25 18:12:11 tgl Exp $
* $Id: catversion.h,v 1.167 2002/12/04 05:18:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200211251
#define CATALOG_VERSION_NO 200212031
#endif

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_conversion.h,v 1.7 2002/11/02 02:33:03 tgl Exp $
* $Id: pg_conversion.h,v 1.8 2002/12/04 05:18:35 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@ -19,6 +19,8 @@
#ifndef PG_CONVERSION_H
#define PG_CONVERSION_H
#include "miscadmin.h"
/* ----------------
* postgres.h contains the system type definitions and the
* CATALOG(), BOOTSTRAP and DATA() sugar words so this file
@ -84,7 +86,7 @@ typedef FormData_pg_conversion *Form_pg_conversion;
#include "nodes/parsenodes.h"
extern Oid ConversionCreate(const char *conname, Oid connamespace,
int32 conowner,
AclId conowner,
int32 conforencoding, int32 contoencoding,
Oid conproc, bool def);
extern void ConversionDrop(Oid conversionOid, DropBehavior behavior);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.276 2002/11/08 17:27:03 momjian Exp $
* $Id: pg_proc.h,v 1.277 2002/12/04 05:18:36 momjian Exp $
*
* NOTES
* 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
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" 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 26 "23" pg_stat_get_backend_userid - _null_ ));
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_ ));
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" pg_stat_get_backend_activity - _null_ ));
DESCR("Statistics: Current query of backend");

View File

@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: miscadmin.h,v 1.111 2002/10/03 17:07:53 momjian Exp $
* $Id: miscadmin.h,v 1.112 2002/12/04 05:18:34 momjian Exp $
*
* NOTES
* some of the information in this file should be moved to
@ -202,7 +202,13 @@ extern void SetDatabasePath(const char *path);
extern char *GetUserNameFromId(Oid userid);
extern Oid GetUserId(void);
/*
* AclId system identifier for the user, group, etc.
* XXX Perhaps replace this type by OID?
*/
typedef uint32 AclId;
extern AclId GetUserId(void);
extern void SetUserId(Oid userid);
extern Oid GetSessionUserId(void);
extern void SetSessionUserId(Oid userid);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: acl.h,v 1.47 2002/09/04 20:31:45 momjian Exp $
* $Id: acl.h,v 1.48 2002/12/04 05:18:38 momjian Exp $
*
* NOTES
* For backward-compatibility purposes we have to allow there
@ -22,16 +22,11 @@
#ifndef ACL_H
#define ACL_H
#include "miscadmin.h"
#include "nodes/parsenodes.h"
#include "utils/array.h"
/*
* AclId system identifier for the user, group, etc.
* XXX Perhaps replace this type by OID?
*/
typedef uint32 AclId;
#define ACL_ID_WORLD 0 /* placeholder for id in a WORLD acl item */
/*
@ -204,11 +199,11 @@ extern AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode);
extern void aclcheck_error(AclResult errcode, const char *objectname);
/* ownercheck routines just return true (owner) or false (not) */
extern bool pg_class_ownercheck(Oid class_oid, Oid userid);
extern bool pg_type_ownercheck(Oid type_oid, Oid userid);
extern bool pg_oper_ownercheck(Oid oper_oid, Oid userid);
extern bool pg_proc_ownercheck(Oid proc_oid, Oid userid);
extern bool pg_namespace_ownercheck(Oid nsp_oid, Oid userid);
extern bool pg_opclass_ownercheck(Oid opc_oid, Oid userid);
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_opclass_ownercheck(Oid opc_oid, AclId userid);
#endif /* ACL_H */

View File

@ -1274,7 +1274,7 @@ SELECT viewname, definition FROM pg_views ORDER BY viewname;
pg_locks | SELECT l.relation, l."database", l."transaction", l.pid, l."mode", l.granted FROM pg_lock_status() l(relation oid, "database" oid, "transaction" xid, pid integer, "mode" text, granted boolean);
pg_rules | SELECT n.nspname AS schemaname, c.relname AS tablename, r.rulename, pg_get_ruledef(r.oid) AS definition FROM ((pg_rewrite r JOIN pg_class c ON ((c.oid = r.ev_class))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (r.rulename <> '_RETURN'::name);
pg_settings | SELECT a.name, a.setting FROM pg_show_all_settings() a(name text, setting text);
pg_stat_activity | SELECT d.oid AS datid, d.datname, pg_stat_get_backend_pid(s.backendid) AS procpid, pg_stat_get_backend_userid(s.backendid) AS usesysid, u.usename, pg_stat_get_backend_activity(s.backendid) AS current_query FROM pg_database d, (SELECT pg_stat_get_backend_idset() AS backendid) s, pg_shadow u WHERE ((pg_stat_get_backend_dbid(s.backendid) = d.oid) AND (pg_stat_get_backend_userid(s.backendid) = (u.usesysid)::oid));
pg_stat_activity | SELECT d.oid AS datid, d.datname, pg_stat_get_backend_pid(s.backendid) AS procpid, pg_stat_get_backend_userid(s.backendid) AS usesysid, u.usename, pg_stat_get_backend_activity(s.backendid) AS current_query FROM pg_database d, (SELECT pg_stat_get_backend_idset() AS backendid) s, pg_shadow u WHERE ((pg_stat_get_backend_dbid(s.backendid) = d.oid) AND (pg_stat_get_backend_userid(s.backendid) = u.usesysid));
pg_stat_all_indexes | SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, pg_stat_get_numscans(i.oid) AS idx_scan, pg_stat_get_tuples_returned(i.oid) AS idx_tup_read, pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch FROM (((pg_class c JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (c.relkind = 'r'::"char");
pg_stat_all_tables | SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_numscans(c.oid) AS seq_scan, pg_stat_get_tuples_returned(c.oid) AS seq_tup_read, sum(pg_stat_get_numscans(i.indexrelid)) AS idx_scan, sum(pg_stat_get_tuples_fetched(i.indexrelid)) AS idx_tup_fetch, pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins, pg_stat_get_tuples_updated(c.oid) AS n_tup_upd, pg_stat_get_tuples_deleted(c.oid) AS n_tup_del FROM ((pg_class c LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (c.relkind = 'r'::"char") GROUP BY c.oid, n.nspname, c.relname;
pg_stat_database | SELECT d.oid AS datid, d.datname, pg_stat_get_db_numbackends(d.oid) AS numbackends, pg_stat_get_db_xact_commit(d.oid) AS xact_commit, pg_stat_get_db_xact_rollback(d.oid) AS xact_rollback, (pg_stat_get_db_blocks_fetched(d.oid) - pg_stat_get_db_blocks_hit(d.oid)) AS blks_read, pg_stat_get_db_blocks_hit(d.oid) AS blks_hit FROM pg_database d;