Find foreign servers that do not have any associated user mappings. "A user mapping typically encapsulates connection information that a foreign-data wrapper uses together with the information encapsulated by a foreign server to access an external data resource."
Notes
The query takes into account that in case of some foreign data wrappers (like file_fdw) a mapping is not needed.
Type
Problem detection (Each row in the result could represent a flaw in the design)
SELECT foreign_server_name, foreign_data_wrapper_name
FROM INFORMATION_SCHEMA.foreign_servers AS fs
WHERE NOT EXISTS (SELECT *
FROM pg_user_mappings
WHERE pg_user_mappings.srvname=fs.foreign_server_name)
AND foreign_data_wrapper_name<>'file_fdw'
ORDER BY foreign_server_name;
Collections
This query belongs to the following collections:
Name
Description
Find problems automatically
Queries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not .
Categories
This query is classified under the following categories:
Name
Description
Distributed database
Queries of this category provide information about the foreign table mechanism.