Re: Can we have a new SQL callable function to get Postmaster PID? - Mailing list pgsql-hackers

From Euler Taveira
Subject Re: Can we have a new SQL callable function to get Postmaster PID?
Date
Msg-id 589d67f1-4a19-4b6d-84bf-da7cf89cf498@www.fastmail.com
Whole thread Raw
In response to Can we have a new SQL callable function to get Postmaster PID?  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: a curious case of force_parallel_mode = on with jit'ing
Next
From: Peter Eisentraut
Date:
Subject: Re: Improve new hash partition bound check error messages