summaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/expected
diff options
context:
space:
mode:
authorFujii Masao2024-09-18 03:51:48 +0000
committerFujii Masao2024-09-18 03:51:48 +0000
commit4f08ab55457751308ffd8d33e82155758cd0e304 (patch)
tree5fd7cac9932bb064c44becfd09870a0cdfb523f1 /contrib/postgres_fdw/expected
parentb14e9ce7d55c75ffa160b07765eb9dffde70b5fa (diff)
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/[email protected]
Diffstat (limited to 'contrib/postgres_fdw/expected')
-rw-r--r--contrib/postgres_fdw/expected/postgres_fdw.out16
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out
index f3eb055e2c7..f2bcd6aa98c 100644
--- a/contrib/postgres_fdw/expected/postgres_fdw.out
+++ b/contrib/postgres_fdw/expected/postgres_fdw.out
@@ -10472,13 +10472,15 @@ NOTICE: drop cascades to 2 other objects
DETAIL: drop cascades to user mapping for public on server loopback3
drop cascades to foreign table ft7
-- List all the existing cached connections. loopback and loopback3
--- should be output as invalid connections. Also the server name for
--- loopback3 should be NULL because the server was dropped.
-SELECT * FROM postgres_fdw_get_connections() ORDER BY 1;
- server_name | valid | used_in_xact | closed
--------------+-------+--------------+--------
- loopback | f | t |
- | f | t |
+-- should be output as invalid connections. Also the server name and user name
+-- for loopback3 should be NULL because both server and user mapping were
+-- dropped.
+SELECT server_name, user_name = CURRENT_USER as "user_name = CURRENT_USER", valid, used_in_xact, closed
+FROM postgres_fdw_get_connections() ORDER BY 1;
+ server_name | user_name = CURRENT_USER | valid | used_in_xact | closed
+-------------+--------------------------+-------+--------------+--------
+ loopback | t | f | t |
+ | | f | t |
(2 rows)
-- The invalid connections get closed in pgfdw_xact_callback during commit.