The list of all the queries

All foreign tables

Query goal: Find all foreign tables.
Query type: General (Overview of some aspect of the database.)
Query license: MIT License
Data source: INFORMATION_SCHEMA only
SQL query: Click on query to copy it

SELECT foreign_table_schema, 
foreign_table_name, 
foreign_server_name,
foreign_data_wrapper_name,
foreign_server_type AS fs_type,
foreign_server_version AS fs_version,
authorization_identifier AS foreign_server_owner,
string_agg(fso.option_name || ': ' || fso.option_value, ';<br>' ORDER BY fso.option_name) AS foreign_server_options,
string_agg(fto.option_name || ': ' || fto.option_value, ';<br>' ORDER BY fto.option_name) AS foreign_table_options
FROM INFORMATION_SCHEMA.foreign_tables INNER JOIN INFORMATION_SCHEMA.foreign_servers USING (foreign_server_name)
LEFT JOIN INFORMATION_SCHEMA.foreign_server_options AS fso USING (foreign_server_name)
LEFT JOIN INFORMATION_SCHEMA.foreign_table_options AS fto USING (foreign_table_schema, foreign_table_name)
GROUP BY foreign_table_schema, 
foreign_table_name, 
foreign_server_name,
foreign_data_wrapper_name,
foreign_server_type,
foreign_server_version,
authorization_identifier
ORDER BY foreign_server_name, foreign_table_schema, foreign_table_name;

Collections where the query belongs to

Collection nameCollection description
Find problems by overviewQueries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not .

Categories where the query belongs to

Category nameCategory description
Distributed databaseQueries of this category provide information about the foreign table mechanism.

The list of all the queries