Re: [HACKERS] pg_stat_database shows userid as OID

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] pg_stat_database shows userid as OID
Date: 2002-12-04 05:20:41
Message-ID: 200212040520.gB45Kff08194@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 19.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tommi Maekitalo 2002-12-04 07:13:20 Re: MySQL update
Previous Message Manuel Cabido 2002-12-04 04:18:13 Re: PostgreSQL in Universities (Was: Re: 7.4 Wishlist)

Browse pgsql-patches by date

  From Date Subject
Next Message Nicolai Tufar 2002-12-04 18:09:30 Turkish essage translation file for backend
Previous Message EMOTO Masahiko 2002-12-04 01:59:43 PAM