PostgreSQL命令未列出所有模式

4

我想知道为什么\d只列出public模式中的表格? 我在数据库中有另一个模式sps,但那些表格没有被列出...

# psql -p 5432 -U postgres -h localhost myDB
Password for user postgres:
psql (9.1.5)
Type "help" for help.

myDB=# \d
                 List of relations
Schema |            Name            |   Type   |  Owner
--------+----------------------------+----------+----------
public | tableA                     | table    | postgres
public | tableB                     | table    | postgres
public | tableC                     | table    | postgres
public | table_col_seq              | sequence | postgres
(4 rows)
2个回答

7

您需要更改您的 search_path。在 psql 中使用 \dn 命令,然后构建您的 search_path

SET search_path = schema1,schema2,public;

0
我在Intellij IDEA的数据库选项卡遇到了这个问题。
我找到了解决方法: 数据源和驱动程序 -> YOUR_DATA_SOURCE -> 模式 -> 选择“所有数据库”

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接