diff options
author | Fujii Masao <fujii@postgresql.org> | 2025-03-03 08:51:30 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2025-03-03 08:51:30 +0900 |
commit | fe186bda78c4a0ccbb691489c744e6317f648434 (patch) | |
tree | 95083aa57d720f90a49fc19c6680a55ef5fc9de8 /doc/src/sgml/postgres-fdw.sgml | |
parent | 15a79c73111f0c9738ee81b796f7de5bfeb3aedc (diff) | |
download | postgresql-fe186bda78c4a0ccbb691489c744e6317f648434.tar.gz postgresql-fe186bda78c4a0ccbb691489c744e6317f648434.zip |
postgres_fdw: Extend postgres_fdw_get_connections to return remote backend PID.
This commit adds a new "remote_backend_pid" output column to
the postgres_fdw_get_connections function. It returns the process ID of
the remote backend, on the foreign server, handling the connection.
This enhancement is useful for troubleshooting, monitoring, and reporting.
For example, if a connection is unexpectedly closed by the foreign server,
the remote backend's PID can help diagnose the cause.
No extension version bump is needed, as commit c297a47c5f already
handled it for v18~.
Author: Sagar Dilip Shedge <sagar.shedge92@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAPhYifF25q5xUQWXETfKwhc0YVa_6+tfG9Kw4bCvCjpCWxYs2A@mail.gmail.com
Diffstat (limited to 'doc/src/sgml/postgres-fdw.sgml')
-rw-r--r-- | doc/src/sgml/postgres-fdw.sgml | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml index d2998c13d5d..a7f2f5ca182 100644 --- a/doc/src/sgml/postgres-fdw.sgml +++ b/doc/src/sgml/postgres-fdw.sgml @@ -854,7 +854,7 @@ OPTIONS (ADD password_required 'false'); <term><function>postgres_fdw_get_connections( IN check_conn boolean DEFAULT false, OUT server_name text, OUT user_name text, OUT valid boolean, OUT used_in_xact boolean, - OUT closed boolean) + OUT closed boolean, OUT remote_backend_pid int4) returns setof record</function></term> <listitem> <para> @@ -882,11 +882,11 @@ OPTIONS (ADD password_required 'false'); Example usage of the function: <screen> postgres=# SELECT * FROM postgres_fdw_get_connections(true); - server_name | user_name | valid | used_in_xact | closed --------------+-----------+-------+--------------+-------- - loopback1 | postgres | t | t | f - loopback2 | public | t | t | f - loopback3 | | f | t | f + server_name | user_name | valid | used_in_xact | closed | remote_backend_pid +-------------+-----------+-------+--------------+----------------------------- + loopback1 | postgres | t | t | f | 1353340 + loopback2 | public | t | t | f | 1353120 + loopback3 | | f | t | f | 1353156 </screen> The output columns are described in <xref linkend="postgres-fdw-get-connections-columns"/>. @@ -951,6 +951,17 @@ postgres=# SELECT * FROM postgres_fdw_get_connections(true); is not available on this platform. </entry> </row> + <row> + <entry><structfield>remote_backend_pid</structfield></entry> + <entry><type>int4</type></entry> + <entry> + Process ID of the remote backend, on the foreign server, + handling the connection. If the remote backend is terminated and + the connection is closed (with <literal>closed</literal> set to + <literal>true</literal>), this still shows the process ID of + the terminated backend. + </entry> + </row> </tbody> </tgroup> </table> |