39

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?

Cardin
  • 5,148
  • 5
  • 36
  • 37
  • 2
    It's not "Postgres" that's problematic - it's pgAdmin –  Feb 28 '17 at 07:52
  • I agree with @a_horse_with_no_name, and by the way pgAdmin4 is hardly 6 months old open source project and may contains bugs but you can logged the bugs and help developers to improve the product. https://redmine.postgresql.org/projects/pgadmin4 – Murtuza Z Feb 28 '17 at 07:57
  • I see... I wasn't aware of that. But in terms of bug severity, not being able to query or view data is pretty high on the catastrophic level. If I find some time a few weeks down I might log a bug, but for now I'm downgrading to PgAdmin3 – Cardin Mar 01 '17 at 08:37
  • 2
    I also have had many problems in windows when trying the different version of pgadmin4. Pgamin III is taking 3 s to open, while pgadmin IV1.6 is much slower 20s. And I'm not able to run any query and don't get anything in the log indicated by n33ma below; Access to the database is also very slow and I'm unable to run any queries. I understand while googling that this is a windows related problem, I hope the developers find a way arround this problem. – Cedric Jul 20 '17 at 14:37
  • 1
    Apparently this bug is still present atm – Milan Velebit Mar 11 '18 at 17:26
  • 1
    I installed pgadmin4 in Windows 10 and the Query Tool doesn't work at all, it just says "Initializing query execution..." forever. I can do anything else, but the query tool just doesn't work. I google and found heaps of similar reports with no solution, just requests for debug logs. – Aaron Mar 25 '18 at 01:13
  • Use any other database management tool, e.g: DbVisualiser, which comes with default PostgreSQL support or anything else on the free web but not pgadmin. WIth pgadmin I had the worst db management experience so far. Don't go for it. Please. – gdrt Jun 05 '18 at 13:18

12 Answers12

64

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.

Fernando Fabreti
  • 4,277
  • 3
  • 32
  • 33
59

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

Guillaume Raymond
  • 1,726
  • 1
  • 20
  • 33
4

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

Murtuza Z
  • 5,639
  • 1
  • 28
  • 52
  • No errors at all. The "Database Activity" panel showed that I was querying the table, but the State: "Idle". I see the Transactions happening, but literally nothing else happens. – Cardin Mar 01 '17 at 08:19
  • I am not getting error you mentioned, I have version 1.2 installed. Did you try with current version pgAdmin4 (version 1.2) ? Download: https://www.pgadmin.org/ – Murtuza Z Mar 01 '17 at 13:47
4

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.

Alexeey
  • 41
  • 3
4

I had a similar problem.

For me the Query Tool did render, however I could not see the Query Tool until after I expanded the view.

Then even after expanding I was not able to see the result of the query until I ran ( File -> Reset Layout ) as Guillaume Raymond suggest.

Before Expand

After Expand

After Running Reset Layout

shane
  • 131
  • 3
2

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.

CamW
  • 3,223
  • 24
  • 34
1

Warning: You may need to recreate connections.

This worked for me.

1.) Shutdown pgadmin4 3.1

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

dbabackup
  • 11
  • 4
1

Faced a similar issue where the problem was caused by Firefox, pgADmin 4. Launching pgAdmin in Chrome solved the issue.

Orion Cygnus
  • 168
  • 1
  • 8
0

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.

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

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.

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

AKumar
  • 21
  • 3
0

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

  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)

After that I could finally work with it

Erich13
  • 69
  • 5
0

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

  1. sudo apt autoremove pgadmin4
  2. sudo apt install pgadmin4 pgadmin4-apache2 -y
0

Personally, I had a dumb issue. I had my DATABASE_URL pointing to another server

DATABASE_URL='postgres://postgres:root@localhost:5432/wrong-database'.

Even though my DATABASE_NAME='correct-database'.

And in my settings.py I was running

db_from_env = dj_database_url.config(conn_max_age=600) DATABASES['default'].update(db_from_env).

Please make sure your .env file is correct.

Edward
  • 55
  • 1
  • 10