Re: Can we have a new SQL callable function to get Postmaster PID?

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: "Bharath Rupireddy" <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Can we have a new SQL callable function to get Postmaster PID?
Date: 2021-02-03 14:24:40
Message-ID: 589d67f1-4a19-4b6d-84bf-da7cf89cf498@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 3, 2021, at 3:12 AM, Bharath Rupireddy wrote:
> Can we have a new function, say pg_postgres_pid(), to return
> postmaster PID similar to pg_backend_pid()?
It is not that difficult to read the postmaster PID using existing functions.

postgres=# SELECT (regexp_match(pg_read_file('postmaster.pid'), '\d+'))[1];
regexp_match
--------------
13496
(1 row)

While investigating an issue, you are probably interested in a backend PID or
one of the auxiliary processes. In both cases, it is easier to obtain the PIDs.

--
Euler Taveira
EDB https://www.enterprisedb.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-02-03 14:52:51 Re: Improve new hash partition bound check error messages
Previous Message Amit Langote 2021-02-03 14:12:14 a curious case of force_parallel_mode = on with jit'ing