Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PgAdmin4 unable to query or view data

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

The View Data option is unresponsive; Query Tool option 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

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.

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?

like image 642
Cardin Avatar asked Feb 26 '17 09:02

Cardin


People also ask

How do I enable query tool in pgAdmin 4?

You can access the Query Tool via the Query Tool menu option on the Tools menu, or through the context menu of select nodes of the Browser tree control.

How can you view the data via pgAdmin?

To view or modify data, right click on a table or view name in the Browser tree control. When the context menu opens, use the View/Edit Data menu to specify the number of rows you would like to display in the editor panel. To modify the content of a table, each row in the table must be uniquely identifiable.


4 Answers

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

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

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

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

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

like image 111
Fernando Fabreti Avatar answered Oct 21 '22 02:10

Fernando Fabreti


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

File -> Reset Layout

like image 20
Guillaume Raymond Avatar answered Oct 21 '22 01:10

Guillaume Raymond


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

2) Start pgAdmin4.

3) Try to view data again

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

like image 4
Murtuza Z Avatar answered Oct 21 '22 01:10

Murtuza Z


Try naming your columns with lower case letters.

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

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.

like image 4
Alexeey Avatar answered Oct 21 '22 00:10

Alexeey