Re: getpid() function - Mailing list pgsql-hackers

From Tom Lane
Subject Re: getpid() function
Date
Msg-id 6810.1028432641@sss.pgh.pa.us
Whole thread Raw
In response to Re: getpid() function  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Sorry, I mean pg_backend_pid.

Okay, I was unsure if that was a typo or not.

> 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.

Yeah, I thought of suggesting pg_backend_id() to return MyBackendId and
then pg_stat_get_backend_pid() to get the PID, but was stopped by the
thought that this breaks down if the stats collector isn't running.
While I'm not convinced that there's any need for backend PID that's not
connected to looking at stats-collector results, it's probably foolish
to set up a mechanism that doesn't work outside that context.  Let's go
with pg_backend_pid().
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: CLUSTER and indisclustered
Next
From: Alvaro Herrera
Date:
Subject: Re: [PATCHES] START TRANSACTION