为什么 PostgreSQL 的 \dt 只显示公共模式表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6931883/
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-09-10 23:03:19  来源:igfitidea点击:

Why does PostgreSQL's \dt show only public schema tables?

postgresql

提问by skanatek

I have created a new schema in my PostgreSQl database with psql:

我用 psql 在我的 PostgreSQl 数据库中创建了一个新模式:

CREATE SCHEMA my_schema;

But when I issue the \dtcommand, I see only the tables that are in the publicschema. However, I can access all the tables in my_schemawith my_schema.table_name.

但是当我发出\dt命令时,我只能看到public模式中的表。但是,我可以my_schema使用my_schema.table_name.

How can I see all the tables from all the schemas in psql?

如何查看 psql 中所有模式中的所有表?

回答by Alex Howansky

For your schema (note the period after the schema name):

对于您的架构(请注意架构名称后面的句点):

\dt my_schema.

Or:

或者:

SET search_path TO my_schema, public;
\dt

For all schemas:

对于所有模式:

\dt *.