Re: getpid() function

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Lockhart <lockhart(at)fourpalms(dot)org>, Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: getpid() function
Date: 2002-08-04 03:38:09
Message-ID: 200208040338.g743c9328045@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> >> Let's take it out and wait to see if anyone really still wants it.
>
> > Just when I am ready to throw it away, I come up with a use for the
> > function:
>
> > test=> select * from pg_stat_activity where procpid != backend_pid();
>
> > This shows all activity _except_ my session, which pgmonitor or others
> > may want to use, and I can think of no other way to do it.
>
> Hm. Actually this seems like an argument for exposing MyBackendId, since
> what pg_stat_activity really depends on is BackendId. But as that view
> is presently defined, you'd not be able to write
> WHERE backendid = my_backend_id()
> because the view doesn't expose backendid.

Yes.

> > Comments? Maybe this is why it should be called pg_backend_id and put
> > in the stat section.
>
> *Please* don't call it pg_backend_id --- that invites confusion with
> BackendId which is a different thing.
>
> I'd suggest pg_backend_pid.

Sorry, I mean pg_backend_pid. I could expose backend_id but it may
confuse people so pid is probably better. If you had the id, you could
use pg_stat_get_backend_pid() to get the pid.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-08-04 03:44:01 Re: getpid() function
Previous Message Tom Lane 2002-08-04 03:32:15 Re: getpid() function

Browse pgsql-hackers by date

  From Date Subject
Next Message mark Kirkwood 2002-08-04 03:39:10 Re: CLUSTER and indisclustered
Previous Message Tom Lane 2002-08-04 03:37:08 Re: CLUSTER and indisclustered