21

In MySQL Workbench, one can use the keyboard shortcut Ctrl + ENTER to execute the statement at cursor (delineated with semi colons).

Is there a similar shortcut in pgAdmin?


For SQL queries that span on only one line, I use a voice command in Dragon NaturallySpeaking:

Sub Main
    SendKeys "{End}"
    Wait(0.3)
    SendKeys "+{Home}"
    Wait(0.3)
    SendKeys "{F5}"
End Sub

enter image description here

but I don't have any solution for SQL queries that span although more than one line.

Franck Dernoncourt
  • 2,083
  • 13
  • 34
  • 52

3 Answers3

8

Since there seems to be no way to define such a keyboard shortcut, I filed a feature request: https://redmine.postgresql.org/issues/1439 , which got rejected:

​Issue #1439 has been updated by Dave Page.

Status changed from New to Rejected

We follow the pgAdmin 3 behaviour in this regard - when you execute a query (or explain etc), if any text is selected, only that text is executed. If nothing is selected, the entire query (or set of queries) are executed.

Since amazingly with pgAdmin one has to login to view issues / feature request, here is a screenshot:

enter image description here

Franck Dernoncourt
  • 2,083
  • 13
  • 34
  • 52
5

You can select your query in pgAdmin sql window and press F5. Same will work if you just put cursor on any line in your statement without actually selecting it but only if your statements are separated with semicolon.

Dimon Buzz
  • 151
  • 2
0

After eight years, I can happily announce that from pgAdmin version 4 - 8.7 it is possible to fully use the Execute query functionality using a keyboard shortcut.

If you are used to the shortcut CTRL+ENTER (or any other), which is supposed to run the query on which the cursor is currently located (bordered by semicolons), you must first set the keyboard shortcut in the preferences: File - Preferences - Query tool - Keyboard shortcuts - Execute query.

From then on, your shortcut will work as expected.

Example

Just one note: In this case, only the semicolon is taken into account, not the lines, i.e. if one query ends in one line and another begins right after semicolon, it depends on the position of the cursor in the line, whether it is before the semicolon (just after it still falls into the first query) or already in the next query. I think it behaves correctly.

Feature request: Missing Execute query functionality

Atiris
  • 126
  • 1
  • 5