如何列出所有外国服务器?

时间:2017-05-24 23:28:58

标签: postgresql

如何从psql命令行列出Postgres数据库中的所有外部服务器? 可以通过create server

创建服务器

2 个答案:

答案 0 :(得分:13)

我只是向专家学习,我们可以输入

\des+

答案 1 :(得分:12)

您可以查询系统目录pg_foreign_server,例如:

select 
    srvname as name, 
    srvowner::regrole as owner, 
    fdwname as wrapper, 
    srvoptions as options
from pg_foreign_server
join pg_foreign_data_wrapper w on w.oid = srvfdw;

      name      |  owner   |   wrapper    |                options                 
----------------+----------+--------------+----------------------------------------
 csv_server     | postgres | file_fdw     | 
 foreign_server | postgres | postgres_fdw | {host=localhost,port=5432,dbname=test}
(2 rows)