如何在PostgreSQL中列出外部表?

Azu*_*uan 4 sql database postgresql

在PostgreSQL中,运行\ d命令将列出表及其表类型。目前,我正在尝试列出使用外部数据包装程序创建的所有外部表。列出这些表的查询是什么?

gar*_*gii 7

仅查询列出外部表:

select * from information_schema.foreign_tables
Run Code Online (Sandbox Code Playgroud)


小智 7

您还可以使用此命令:

\detr
Run Code Online (Sandbox Code Playgroud)


a_h*_*ame 6

根据手册\dE[S+]应该这样做。

http://www.postgresql.org/docs/current/static/app-psql.html

要查看其后的查询,请使用-e(“回显查询”)选项启动psql 。

或使用以下information_schema.tables视图:http : //www.postgresql.org/docs/current/static/infoschema-tables.html

table_type列将包含FOREIGN TABLE这些表。

  • 文档确实对我有帮助。谢谢:)我使用以下查询:从information_schema.tables中选择table_name,table_type,其中table_type ='FOREIGN TABLE'和table_schema ='public'; (3认同)