23

As the title already says:

I am trying to make a SELECT statement in the "view/edit data" mode in pgadmin 4, but the query window is disabled. How can I enable it? (I am the owner of all the database, the schema and table and have all privileges for all of them)

enter image description here

Suneel Kumar
  • 1,650
  • 2
  • 21
  • 31
JoeBe
  • 1,224
  • 3
  • 13
  • 28

3 Answers3

22

You cannot edit the query in VIEW DATA mode. If you want to write custom SELECT/SQL code then use Query tool option.

enter image description here

Murtuza Z
  • 5,639
  • 1
  • 28
  • 52
  • 76
    I hate this so much. – creamcheese Sep 07 '19 at 12:04
  • @Intellix Use the latest version, Now using query tool you can edit/update data, View data is no longer the only option for data updation :) – Murtuza Z Sep 07 '19 at 12:06
  • 6
    @MurtuzaZ I have version 4.18 and still can't edit in the view data editor. – raphael75 Apr 22 '20 at 17:07
  • that's the kind of things that let me stay on PgAdmin3 – Chopchop Sep 16 '20 at 13:36
  • 6
    I hate that the Query Tool starts you off with a blank slate, and that you can't edit the query that it pops out for you in View Mode. Is there a way to get an editable query that includes all column names, like you can with SQL Server Management Studio? It serves as a great jumping off point for doing simple joins and the like. – rook218 Dec 29 '20 at 15:09
  • 13
    Why would anyone think that it is a good idea to prohibit copy and editing SQL in an SQL management tool. This is easy top 5 most infuriating non-feature seen over 25 years of software use. Still so in 5.4 – user1997614 Jul 29 '21 at 17:00
  • 4
    @user1997614 this is still in 6.10. I think it's time do a fork without this annoying setting. – JonathanReez Aug 22 '22 at 21:02
4

You need to set a primary key on the table to be able to add items to the table in "View/Edit Data" mode.

Jon
  • 1,060
  • 8
  • 15
  • 1
    Adding the primary_key into your query?!?! So simple and so frustrating. This should be the real answer!!! – wruckie May 18 '22 at 20:13
1

If you want to be able to modify the sql query instead of view/edit data go to Scripts -> Select Script enter image description here

telebog
  • 1,706
  • 5
  • 25
  • 34