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