Query goal: | 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 about the query: | The query takes into account that in case of some foreign data wrappers (like file_fdw) a mapping is not needed. |
Query type: | Problem detection (Each row in the result could represent a flaw in the design) |
Query reliability: | Medium (Medium number of false-positive results) |
Query license: | MIT License |
Data source: | INFORMATION_SCHEMA+system catalog |
SQL query: | Click on query to copy it
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; |
Collection name | Collection 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 . |
Category name | Category description |
---|---|
Distributed database | Queries of this category provide information about the foreign table mechanism. |