سؤال

As seen in a stackoverflow answer I can use the psql command and the \dew[+] command in order to list the foreign wrappers.

But the use of universal database tools such as DBEaver, DataGrid, etc make our lives easier. Using these tools how I can list all the available data wrappers and how I can find out whether they are used?

هل كانت مفيدة؟

المحلول

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> \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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى dba.stackexchange
scroll top