pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.42k stars 635 forks source link

Missing Execute query functionality #6841

Closed atiris closed 3 months ago

atiris commented 11 months ago

Describe the bug

Currently, pgAdmin does not provide any functionality that could be called Execute query.

Although the keyboard shortcuts section contains "Execute query" option, using this shortcut will not actually run the query. Instead, the entire script is executed (all queries listed in the editor, regardless of which query is currently edited). It is possible to select a block and run the given block of code, but this is not "Execute query" in the sense in which it is understood by standard. Such behavior is usually called "Execute script" or "Execute selection".

Since the function to run an active query, I working on (either selected by marking the given text of this query or the one on which the cursor is currently placed) is essential for the sql editor, I rate it as a bug, not as a feature request.

Please don't reject this request just by sticking to historical decisions If you do not agree that this is a bug, then at least change the status of this request to a feature request and assign it a low priority. After all, the addition of new functionality won't certainly cause any harm and will definitely help some users.

To Reproduce

Steps to reproduce the behavior:

  1. Write 1. query into Query Tool and terminate it with semicolon.
  2. Use keyboard shortcut for "Execute query".
  3. Write 2. query and terminate it.
  4. Use the program function labeled as "Execute query".
  5. All queries (entire script) is executed without asking which query I want to execute.

Expected behavior

As the name of this functionality says, a (single / active) query should be executed.

Desktop (please complete the following information):

Additional context

Clone from redmine.postgresql.org issue 7885 as I don't know which place to report the error is correct.

agaillar commented 11 months ago

As far as I'm concerned, being able to execute the current query (where the cursor is positioned) is an essential and indispensable feature. It's because of this lack that I regularly switch to the CloudBeaver editor, even though it's less complete than PGAdmin.

anthonydb commented 7 months ago

I'd like to chime in and support this feature's development. It's one of the features I like most about DataGrip and would love to see happen in pgAdmin as well.

adityatoshniwal commented 7 months ago

@anthonydb Sure you can. But may be wait for one in progress upgrade of CodeMirror 5 to 6 - the UI editor library. Once done, it will be easy for you to parse the queries separated by semi-colon.

pravesh-sharma commented 3 months ago

Tested feature on candidate build with both provided test cases and additional ones, is working as expected.

Env: OS - macOS Sonoma 14.4.1 Mode - Desktop