List Postgresql foreign data wrappers without the use of the `psql` command
If you want to find out which SQL queries psql uses, start it with the --echo-hidden  parameter, then run the psql command you are interested in, and it will show the query on the console:

$ psql --echo-hidden
psql (11.4)
Type "help" for help.

postgres&gt; \dew
********* QUERY **********
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;
**************************

   List of foreign-data wrappers
 Name | Owner | Handler | Validator
------+-------+---------+-----------
(0 rows)


This works for all internal commands that show information from the system catalogs.