I have found that the following query lists all my foreign tables in my PostgreSQL database:
select * from information_schema."tables" where table_type='FOREIGN TABLE';
Now I want to find out the foreign wrapper connection that a database is referred into. In this answer the following query lists all my foreign wrappers:
SELECT fdw.fdwname AS "Name", pg_catalog.pg_get_userbyid(fdw.fdwowner) AS "Owner", fdw.fdwhandler::pg_catalog.regproc AS "Handler", fdw.fdwvalidator::pg_catalog.regproc AS "Validator" FROM pg_catalog.pg_foreign_data_wrapper fdw ORDER BY 1;
Now what I want is to find out how to combine this information in order to find out in which foreign wrapper a foreign table belongs into. Do you have any idea how to query that?