Re: [HACKERS] pg_stat_database shows userid as OID - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [HACKERS] pg_stat_database shows userid as OID
Date
Msg-id 200212040520.gB45Kff08194@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
OK, with three people thinking we need to make usesysid more constently
int4, and no one objecting, I have applied this patch, and that attached
patch which makes usesysid constently int4, and not oid.

Catalog version updated.  initdb required.

If there are more places that think usesysid is oid, please let me know.
AclId already existed for this purpose, so I used that rather than int32
directly.

---------------------------------------------------------------------------

Alvaro Herrera wrote:
> Hello hackers,
>
> In the pg_stat_activity view, the usesysid is shown as having type Oid.
> However pg_shadow says it's an integer.  Is there a reason? Looks like
> a bug.
>
> This patch seems to corrects this issue, but I don't know if there's
> something else involved.
>
> Index: src/include/catalog/pg_proc.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/include/catalog/pg_proc.h,v
> retrieving revision 1.276
> diff -c -r1.276 pg_proc.h
> *** src/include/catalog/pg_proc.h    2002/11/08 17:27:03    1.276
> --- src/include/catalog/pg_proc.h    2002/11/16 23:18:44
> ***************
> *** 2738,2744 ****
>   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_ )); 
>   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");
> --- 2738,2744 ----
>   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 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");
> Index: src/backend/utils/adt/pgstatfuncs.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/adt/pgstatfuncs.c,v
> retrieving revision 1.8
> diff -c -r1.8 pgstatfuncs.c
> *** src/backend/utils/adt/pgstatfuncs.c    2002/08/20 04:47:52    1.8
> --- src/backend/utils/adt/pgstatfuncs.c    2002/11/16 23:18:44
> ***************
> *** 272,278 ****
>       if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
>           PG_RETURN_NULL();
>
> !     PG_RETURN_OID(beentry->userid);
>   }
>
>
> --- 272,278 ----
>       if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
>           PG_RETURN_NULL();
>
> !     PG_RETURN_INT32(beentry->userid);
>   }
>
>
> --
> Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
> "El miedo atento y previsor es la madre de la seguridad" (E. Burke)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/catalog/aclchk.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/catalog/aclchk.c,v
retrieving revision 1.78
diff -c -c -r1.78 aclchk.c
*** src/backend/catalog/aclchk.c    24 Sep 2002 23:14:25 -0000    1.78
--- src/backend/catalog/aclchk.c    4 Dec 2002 05:16:29 -0000
***************
*** 893,899 ****
   * Exported routine for checking a user's access privileges to a table
   */
  AclResult
! pg_class_aclcheck(Oid table_oid, Oid userid, AclMode mode)
  {
      AclResult    result;
      bool        usesuper,
--- 893,899 ----
   * Exported routine for checking a user's access privileges to a table
   */
  AclResult
! pg_class_aclcheck(Oid table_oid, AclId userid, AclMode mode)
  {
      AclResult    result;
      bool        usesuper,
***************
*** 991,997 ****
   * Exported routine for checking a user's access privileges to a database
   */
  AclResult
! pg_database_aclcheck(Oid db_oid, Oid userid, AclMode mode)
  {
      AclResult    result;
      Relation    pg_database;
--- 991,997 ----
   * Exported routine for checking a user's access privileges to a database
   */
  AclResult
! pg_database_aclcheck(Oid db_oid, AclId userid, AclMode mode)
  {
      AclResult    result;
      Relation    pg_database;
***************
*** 1054,1060 ****
   * Exported routine for checking a user's access privileges to a function
   */
  AclResult
! pg_proc_aclcheck(Oid proc_oid, Oid userid, AclMode mode)
  {
      AclResult    result;
      HeapTuple    tuple;
--- 1054,1060 ----
   * Exported routine for checking a user's access privileges to a function
   */
  AclResult
! pg_proc_aclcheck(Oid proc_oid, AclId userid, AclMode mode)
  {
      AclResult    result;
      HeapTuple    tuple;
***************
*** 1107,1113 ****
   * Exported routine for checking a user's access privileges to a language
   */
  AclResult
! pg_language_aclcheck(Oid lang_oid, Oid userid, AclMode mode)
  {
      AclResult    result;
      HeapTuple    tuple;
--- 1107,1113 ----
   * Exported routine for checking a user's access privileges to a language
   */
  AclResult
! pg_language_aclcheck(Oid lang_oid, AclId userid, AclMode mode)
  {
      AclResult    result;
      HeapTuple    tuple;
***************
*** 1157,1163 ****
   * Exported routine for checking a user's access privileges to a namespace
   */
  AclResult
! pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode)
  {
      AclResult    result;
      HeapTuple    tuple;
--- 1157,1163 ----
   * Exported routine for checking a user's access privileges to a namespace
   */
  AclResult
! pg_namespace_aclcheck(Oid nsp_oid, AclId userid, AclMode mode)
  {
      AclResult    result;
      HeapTuple    tuple;
***************
*** 1218,1224 ****
   * Ownership check for a relation (specified by OID).
   */
  bool
! pg_class_ownercheck(Oid class_oid, Oid userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
--- 1218,1224 ----
   * Ownership check for a relation (specified by OID).
   */
  bool
! pg_class_ownercheck(Oid class_oid, AclId userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
***************
*** 1244,1250 ****
   * Ownership check for a type (specified by OID).
   */
  bool
! pg_type_ownercheck(Oid type_oid, Oid userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
--- 1244,1250 ----
   * Ownership check for a type (specified by OID).
   */
  bool
! pg_type_ownercheck(Oid type_oid, AclId userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
***************
*** 1270,1276 ****
   * Ownership check for an operator (specified by OID).
   */
  bool
! pg_oper_ownercheck(Oid oper_oid, Oid userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
--- 1270,1276 ----
   * Ownership check for an operator (specified by OID).
   */
  bool
! pg_oper_ownercheck(Oid oper_oid, AclId userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
***************
*** 1296,1302 ****
   * Ownership check for a function (specified by OID).
   */
  bool
! pg_proc_ownercheck(Oid proc_oid, Oid userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
--- 1296,1302 ----
   * Ownership check for a function (specified by OID).
   */
  bool
! pg_proc_ownercheck(Oid proc_oid, AclId userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
***************
*** 1322,1328 ****
   * Ownership check for a namespace (specified by OID).
   */
  bool
! pg_namespace_ownercheck(Oid nsp_oid, Oid userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
--- 1322,1328 ----
   * Ownership check for a namespace (specified by OID).
   */
  bool
! pg_namespace_ownercheck(Oid nsp_oid, AclId userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
***************
*** 1349,1355 ****
   * Ownership check for an operator class (specified by OID).
   */
  bool
! pg_opclass_ownercheck(Oid opc_oid, Oid userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
--- 1349,1355 ----
   * Ownership check for an operator class (specified by OID).
   */
  bool
! pg_opclass_ownercheck(Oid opc_oid, AclId userid)
  {
      HeapTuple    tuple;
      AclId        owner_id;
Index: src/backend/catalog/namespace.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/catalog/namespace.c,v
retrieving revision 1.40
diff -c -c -r1.40 namespace.c
*** src/backend/catalog/namespace.c    11 Nov 2002 22:19:21 -0000    1.40
--- src/backend/catalog/namespace.c    4 Dec 2002 05:16:36 -0000
***************
*** 1365,1371 ****
  static void
  recomputeNamespacePath(void)
  {
!     Oid            userId = GetUserId();
      char       *rawname;
      List       *namelist;
      List       *oidlist;
--- 1365,1371 ----
  static void
  recomputeNamespacePath(void)
  {
!     AclId        userId = GetUserId();
      char       *rawname;
      List       *namelist;
      List       *oidlist;
Index: src/backend/catalog/pg_conversion.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/catalog/pg_conversion.c,v
retrieving revision 1.8
diff -c -c -r1.8 pg_conversion.c
*** src/backend/catalog/pg_conversion.c    2 Nov 2002 18:41:21 -0000    1.8
--- src/backend/catalog/pg_conversion.c    4 Dec 2002 05:16:37 -0000
***************
*** 37,43 ****
   */
  Oid
  ConversionCreate(const char *conname, Oid connamespace,
!                  int32 conowner,
                   int32 conforencoding, int32 contoencoding,
                   Oid conproc, bool def)
  {
--- 37,43 ----
   */
  Oid
  ConversionCreate(const char *conname, Oid connamespace,
!                  AclId conowner,
                   int32 conforencoding, int32 contoencoding,
                   Oid conproc, bool def)
  {
Index: src/backend/commands/cluster.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/commands/cluster.c,v
retrieving revision 1.97
diff -c -c -r1.97 cluster.c
*** src/backend/commands/cluster.c    23 Nov 2002 18:26:45 -0000    1.97
--- src/backend/commands/cluster.c    4 Dec 2002 05:16:37 -0000
***************
*** 804,814 ****

  /* 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
   * clustered.
   */
  List *
! get_tables_to_cluster(Oid owner)
  {
      Relation        indRelation;
      HeapScanDesc    scan;
--- 804,814 ----

  /* 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
   * clustered.
   */
  List *
! get_tables_to_cluster(AclId owner)
  {
      Relation        indRelation;
      HeapScanDesc    scan;
Index: src/backend/utils/adt/pgstatfuncs.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/utils/adt/pgstatfuncs.c,v
retrieving revision 1.8
diff -c -c -r1.8 pgstatfuncs.c
*** src/backend/utils/adt/pgstatfuncs.c    20 Aug 2002 04:47:52 -0000    1.8
--- src/backend/utils/adt/pgstatfuncs.c    4 Dec 2002 05:16:38 -0000
***************
*** 272,278 ****
      if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
          PG_RETURN_NULL();

!     PG_RETURN_OID(beentry->userid);
  }


--- 272,278 ----
      if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
          PG_RETURN_NULL();

!     PG_RETURN_INT32(beentry->userid);
  }


Index: src/include/miscadmin.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/miscadmin.h,v
retrieving revision 1.111
diff -c -c -r1.111 miscadmin.h
*** src/include/miscadmin.h    3 Oct 2002 17:07:53 -0000    1.111
--- src/include/miscadmin.h    4 Dec 2002 05:16:39 -0000
***************
*** 202,208 ****

  extern char *GetUserNameFromId(Oid userid);

! extern Oid    GetUserId(void);
  extern void SetUserId(Oid userid);
  extern Oid    GetSessionUserId(void);
  extern void SetSessionUserId(Oid userid);
--- 202,214 ----

  extern char *GetUserNameFromId(Oid userid);

! /*
!  * 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);
Index: src/include/catalog/catversion.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/catalog/catversion.h,v
retrieving revision 1.166
diff -c -c -r1.166 catversion.h
*** src/include/catalog/catversion.h    25 Nov 2002 18:12:11 -0000    1.166
--- src/include/catalog/catversion.h    4 Dec 2002 05:16:39 -0000
***************
*** 53,58 ****
   */

  /*                            yyyymmddN */
! #define CATALOG_VERSION_NO    200211251

  #endif
--- 53,58 ----
   */

  /*                            yyyymmddN */
! #define CATALOG_VERSION_NO    200212031

  #endif
Index: src/include/catalog/pg_conversion.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/catalog/pg_conversion.h,v
retrieving revision 1.7
diff -c -c -r1.7 pg_conversion.h
*** src/include/catalog/pg_conversion.h    2 Nov 2002 02:33:03 -0000    1.7
--- src/include/catalog/pg_conversion.h    4 Dec 2002 05:16:40 -0000
***************
*** 19,24 ****
--- 19,26 ----
  #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,90 ****
  #include "nodes/parsenodes.h"

  extern Oid ConversionCreate(const char *conname, Oid connamespace,
!                  int32 conowner,
                   int32 conforencoding, int32 contoencoding,
                   Oid conproc, bool def);
  extern void ConversionDrop(Oid conversionOid, DropBehavior behavior);
--- 86,92 ----
  #include "nodes/parsenodes.h"

  extern Oid ConversionCreate(const char *conname, Oid connamespace,
!                  AclId conowner,
                   int32 conforencoding, int32 contoencoding,
                   Oid conproc, bool def);
  extern void ConversionDrop(Oid conversionOid, DropBehavior behavior);
Index: src/include/catalog/pg_proc.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/catalog/pg_proc.h,v
retrieving revision 1.276
diff -c -c -r1.276 pg_proc.h
*** src/include/catalog/pg_proc.h    8 Nov 2002 17:27:03 -0000    1.276
--- src/include/catalog/pg_proc.h    4 Dec 2002 05:16:48 -0000
***************
*** 2738,2744 ****
  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_ )); 
  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");
--- 2738,2744 ----
  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 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");
Index: src/include/utils/acl.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/utils/acl.h,v
retrieving revision 1.47
diff -c -c -r1.47 acl.h
*** src/include/utils/acl.h    4 Sep 2002 20:31:45 -0000    1.47
--- src/include/utils/acl.h    4 Dec 2002 05:16:48 -0000
***************
*** 22,37 ****
  #ifndef ACL_H
  #define ACL_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 */

  /*
--- 22,32 ----
  #ifndef ACL_H
  #define ACL_H

+ #include "miscadmin.h"
  #include "nodes/parsenodes.h"
  #include "utils/array.h"


  #define ACL_ID_WORLD    0        /* placeholder for id in a WORLD acl item */

  /*
***************
*** 204,214 ****
  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);

  #endif   /* ACL_H */
--- 199,209 ----
  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, 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 */
Index: src/test/regress/expected/rules.out
===================================================================
RCS file: /cvsroot/pgsql-server/src/test/regress/expected/rules.out,v
retrieving revision 1.68
diff -c -c -r1.68 rules.out
*** src/test/regress/expected/rules.out    21 Nov 2002 22:26:01 -0000    1.68
--- src/test/regress/expected/rules.out    4 Dec 2002 05:16:50 -0000
***************
*** 1274,1280 ****
   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)
ASdefinition 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_queryFROM 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_all_indexes      | SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname
ASindexrelname, 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_classi 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
JOINpg_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)
ASblks_hit FROM pg_database d; 
--- 1274,1280 ----
   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)
ASdefinition 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_queryFROM 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
ASindexrelname, 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_classi 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
JOINpg_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)
ASblks_hit FROM pg_database d; 

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: openbsd getpeereid(), local ident
Next
From: Nicolai Tufar
Date:
Subject: Turkish essage translation file for backend