windows PgAdmin4 无法查询或查看数据

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

PgAdmin4 unable to query or view data

windowspgadmin-4

提问by Cardin Lee JH

I have a very basic PostgreSql table. Despite the simple table schema, I cannot query it via PgAdmin4.

我有一个非常基本的 PostgreSql 表。尽管表模式很简单,但我无法通过 PgAdmin4 查询它。

The View Dataoption is unresponsive; Query Tooloption becomes unresponsive after a few attempts in opening and closing the panel. When the Query Tool is eventually (somehow) launched, a trivial SQL statement like

View Data选项无响应;Query Tool在尝试打开和关闭面板几次后,选项变得无响应。当查询工具最终(以某种方式)启动时,一个简单的 SQL 语句,如

SELECT * FROM test_table

SELECT * FROM test_table

will spin forever and never display.

将永远旋转,永远不会显示。

View of Database

数据库视图

The diagram above shows the exact same table, which is okay under PgAdmin3.

上图显示了完全相同的表,在 PgAdmin3 下是可以的。

The table was created empty. Then added with a row. But it threw errors about not having a Primary Key. Which also threw errors when I tried to set a Primary Key. So I used TeamPostgreSql to set a Primary Key. So all is good under PgAdmin3 now. Hence I'm really curious about what's going on with PgAdmin4?

该表被创建为空。然后加了一行。但是它抛出了关于没有主键的错误。当我尝试设置主键时,这也会引发错误。所以我使用 TeamPostgreSql 来设置主键。所以现在在 PgAdmin3 下一切都很好。因此,我真的很好奇 PgAdmin4 发生了什么?

回答by Fernando Fabreti

I'm running pgAdmin4 v3.0 and I've put localhostas host name.

我正在运行 pgAdmin4 v3.0 并已将其localhost作为主机名。

I mean, left panel > servers > create > serverand then connection tab > host name

我的意思是,left panel > servers > create > server然后connection tab > host name

I could not query tables, clicking on view/edit data> all rowshad no results (nor error log entries).

我无法查询表,单击view/edit data>all rows没有结果(也没有错误日志条目)。

After I changed server name from localhostto 127.0.0.1, all worked as expected!

在我将服务器名称从 更改localhost为 后127.0.0.1一切都按预期工作!

I hope it helps, because I've lost so much time on this and could not find a proper answer.

我希望它会有所帮助,因为我在这件事上浪费了太多时间并且找不到正确的答案。

回答by Guillaume Raymond

I find a way to view query result on Data Output window using the "Reset Layout" command from File menu. Save your current work (query) before as it will kind of restart pgAdmin4. Tested with pgAdmin 2.1

我找到了一种使用“文件”菜单中的“重置布局”命令在“数据输出”窗口上查看查询结果的方法。之前保存您当前的工作(查询),因为它会重新启动 pgAdmin4。使用 pgAdmin 2.1 测试

File ->Reset Layout

文件 ->重置布局

回答by Murtuza Z

1) First delete the log file to get rid of older logs

1)首先删除日志文件以摆脱旧日志

2) Start pgAdmin4.

2) 启动 pgAdmin4。

3) Try to view data again

3)尝试再次查看数据

Can you check log file for any errors & paste it here?

您可以检查日志文件是否有任何错误并将其粘贴到此处吗?

Linux log location: ~/.pgadmin/pgadmin4.log

Windows log location: C:\Users\YOUR_USERNAME\AppData\Roaming\pgAdmin\pgadmin4.log

Linux 日志位置:~/.pgadmin/pgadmin4.log

Windows 日志位置:C:\Users\YOUR_USERNAME\AppData\Roaming\pgAdmin\pgadmin4.log

回答by Alexeey

Try naming your columns with lower case letters.

尝试用小写字母命名您的列。

Or try with a blank query and write the SQL commands manually:

或者尝试使用空白查询并手动编写 SQL 命令:

SELECT * FROM “test_table”
ORDER BY “Apple” ASC

I think this is a bug. The command the pgAdmin 4 is sending, does not contain the double quotes in the order command on the column name, and if you have upper case letters, SQL is going to convert them to lower case letters, thus not finding the sorting criteria.

我认为这是一个错误。pgAdmin 4 发送的命令,在列名的 order 命令中不包含双引号,如果有大写字母,SQL 会将它们转换为小写字母,因此找不到排序条件。

回答by CamW

I fixed this by opening the connection, changing just the connection name and saving the connection.

我通过打开连接来解决这个问题,只更改连接名称并保存连接。

Based on other comments, I'd say there is likely some difference in the persisted format of the connection and they need to be resaved by the new version to work.

根据其他评论,我会说连接的持久格式可能存在一些差异,新版本需要重新保存它们才能工作。

回答by dbabackup

Warning: You may need to recreate connections.

警告:您可能需要重新创建连接。

This worked for me.

这对我有用。

1.) Shutdown pgadmin4 3.1

1.) 关闭 pgadmin4 3.1

2.) Delete folder: C:\Users\YOUR_USERNAME\AppData\Roaming\pgAdmin

2.) 删除文件夹:C:\Users\YOUR_USERNAME\AppData\Roaming\pgAdmin

回答by AKumar

This problem I experienced with the internet explorer browser where the query tool was not loading at all. It just kept on spinning with a circle. I solved this issue by using chrome browser.

我在 Internet Explorer 浏览器中遇到了这个问题,其中查询工具根本没有加载。它只是继续旋转一个圆圈。我通过使用 chrome 浏览器解决了这个问题。

When you launch pgadmin4 it launches in internet explorer by deafult. it has a key attached to it like

当您启动 pgadmin4 时,它会默认在 Internet Explorer 中启动。它上面有一个钥匙,就像

http://127.0.0.1:57756/?key=0371aabd-b4c7-4454-8234-b1234416d7e5e.

http://127.0.0.1:57756/?key=0371aabd-b4c7-4454-8234-b1234416d7e5e

you can just paste the above url in the browser directly and the pgadmin4 will open and query tool works in it. Or you cna use cmd and paste the belwo command and pgadmin4 will open as a standlone application rather tahn another tab in the browser and you cna use it like old pgadmin3.

您可以直接将上述网址粘贴到浏览器中,pgadmin4 将打开并在其中运行查询工具。或者你 cna 使用 cmd 并粘贴 belwo 命令,pgadmin4 将作为独立应用程序打开,而不是浏览器中的另一个选项卡,你 cna 像旧的 pgadmin3 一样使用它。

C:\windows\system32>"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app=http://127.0.0.1:57756/?key=0371aabd-b4c7-4454-8234-b1234416d7e5e

C:\windows\system32>"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app= http://127.0.0.1:57756/?key=0371aabd-b4c7-4454- 8234-b1234416d7e5e

回答by Erich13

I had the same problem (version 4.18). Only the following worked for me:

我遇到了同样的问题(4.18 版)。只有以下对我有用:

  1. Create a new server group (!) by right-clicking on "servers" in the left-hand navigation.

  2. In this new group I created the desired connection to the database (with host name 127.0.0.1)

  1. 通过右键单击左侧导航中的“服务器”来创建一个新的服务器组 (!)。

  2. 在这个新组中,我创建了所需的数据库连接(主机名 127.0.0.1)

After that I could finally work with it

之后我终于可以使用它了

回答by trungkien_hust

You can remove pgadmin4, then reinstall it. It worked for me. I used Ubuntu 18.04. Here is my command on terminal:

您可以删除 pgadmin4,然后重新安装它。它对我有用。我使用了 Ubuntu 18.04。这是我在终端上的命令:

  1. sudo apt autoremove pgadmin4
  2. sudo apt install pgadmin4 pgadmin4-apache2 -y
  1. sudo apt 自动删除 pgadmin4
  2. sudo apt install pgadmin4 pgadmin4-apache2 -y