如何从psql命令行列出Postgres数据库中的所有外部服务器? 可以通过create server
创建服务器答案 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)