aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2024-09-18 12:51:48 +0900
committerFujii Masao <fujii@postgresql.org>2024-09-18 12:51:48 +0900
commit4f08ab55457751308ffd8d33e82155758cd0e304 (patch)
tree5fd7cac9932bb064c44becfd09870a0cdfb523f1 /doc/src
parentb14e9ce7d55c75ffa160b07765eb9dffde70b5fa (diff)
downloadpostgresql-4f08ab55457751308ffd8d33e82155758cd0e304.tar.gz
postgresql-4f08ab55457751308ffd8d33e82155758cd0e304.zip
postgres_fdw: Extend postgres_fdw_get_connections to return user name.
This commit adds a "user_name" output column to the postgres_fdw_get_connections function, returning the name of the local user mapped to the foreign server for each connection. If a public mapping is used, it returns "public." This helps identify postgres_fdw connections more easily, such as determining which connections are invalid, closed, or used within the current transaction. No extension version bump is needed, as commit c297a47c5f already handled it for v18~. Author: Hayato Kuroda Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/b492a935-6c7e-8c08-e485-3c1d64d7d10f@oss.nttdata.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/postgres-fdw.sgml23
1 files changed, 18 insertions, 5 deletions
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml
index 468724e94ef..627bb5ab5cc 100644
--- a/doc/src/sgml/postgres-fdw.sgml
+++ b/doc/src/sgml/postgres-fdw.sgml
@@ -779,7 +779,8 @@ OPTIONS (ADD password_required 'false');
<varlistentry>
<term><function>postgres_fdw_get_connections(
IN check_conn boolean DEFAULT false, OUT server_name text,
- OUT valid boolean, OUT used_in_xact boolean, OUT closed boolean)
+ OUT user_name text, OUT valid boolean, OUT used_in_xact boolean,
+ OUT closed boolean)
returns setof record</function></term>
<listitem>
<para>
@@ -806,10 +807,12 @@ OPTIONS (ADD password_required 'false');
<para>
Example usage of the function:
<screen>
- server_name | valid | used_in_xact | closed
--------------+-------+--------------+--------
- loopback1 | t | t |
- loopback2 | f | t |
+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
</screen>
The output columns are described in
<xref linkend="postgres-fdw-get-connections-columns"/>.
@@ -837,6 +840,16 @@ OPTIONS (ADD password_required 'false');
</entry>
</row>
<row>
+ <entry><structfield>user_name</structfield></entry>
+ <entry><type>text</type></entry>
+ <entry>
+ Name of the local user mapped to the foreign server of this
+ connection, or <literal>public</literal> if a public mapping is used.
+ If the user mapping is dropped but the connection remains open
+ (i.e., marked as invalid), this will be <literal>NULL</literal>.
+ </entry>
+ </row>
+ <row>
<entry><structfield>valid</structfield></entry>
<entry><type>boolean</type></entry>
<entry>