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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44170038/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:34:43  来源:igfitidea点击:

How to list all foreign servers?

postgresql

提问by Andong Zhan

How to list all foreign servers in a Postgres database from psql command line? Servers can be created by create server

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

回答by Andong Zhan

I just learn from an expert that we can type

我只是从一位专家那里了解到我们可以打字

\des+

回答by klin

You can query the system catalog pg_foreign_server, e.g.:

您可以查询系统目录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)