postgresql psql:尽管存在关系,但未发现任何关系

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

psql: no relations found despite existing relations

sqlpostgresqlschemapsql

提问by lostinthebits

Version 8.4.16 (no choice in version).

版本 8.4.16(版本无选择)。

I log into my db as follows:

我登录到我的数据库如下:

psql -d JRuser

The resulting prompt is:

结果提示是:

JRuser=>

I do \d or \dt expecting to see a list of all the relations in schema 'translate'

我做 \d 或 \dt 希望看到模式“翻译”中所有关系的列表

No relations found. 

But I can select from any of the tables in the schema without any issues. For example:

但是我可以从模式中的任何表中进行选择,而不会出现任何问题。例如:

select * from translate.storage; --works fine

I have ensured that the access privileges are correct for JRuser by doing \dn+:

我通过执行 \dn+ 确保 JRuser 的访问权限是正确的:

                                 List of schemas
        Name        |  Owner   |  Access privileges   |           Description  
translate           | JRuser   | JRuser=UC/JRuser     | 
                               : postgres=UC/JRuser     

Why can't I see the tables in the translate schema?

为什么我看不到翻译架构中的表?

回答by Erwin Brandstetter

\din psql only shows visibletables, i.e. in your search_path.

\d在 psql 中只显示可见表,即在您的search_path.

Try and see:

试试看:

SHOW search_path;
SET search_path= translate;
\d

The setting for your session has probably been changed somehow. There are multiple ways to do that:

您的会话设置可能已以某种方式更改。有多种方法可以做到这一点:

Related later question on dba.SE:

dba.SE 上的相关后续问题: