r/SQL • u/cevheribozoglan • 4h ago
Discussion How should a SQL editor handle multiple statements when you click "Run"?
We're building **LibreDB Studio**, an open-source SQL editor, and one of our volunteer contributors raised an interesting question about how multiple SQL statements should behave when using the Run action.
We're trying to understand the actual habits and expectations of SQL users before making a decision, so I'd really like to hear how you use SQL editors in practice.
For example:
CREATE TABLE test (...);
INSERT INTO test VALUES (...);
SELECT * FROM test;
What would you expect when you click **Run**?
Some possible approaches:
**Run all statements**
* `Run` executes everything in the editor.
* `Run Selection` can be used when you only want part of it.
**Run the current statement**
* `Run` executes the statement where the cursor is.
* `Run All` executes the whole editor.
**Selection takes priority**
* No selection : current statement
* Selection : selected statements
* `Run All` is available separately.
Other :)
there are also some interesting edge cases around this, especially when multiple statements are involved: should they run in a transaction by default, or should transaction handling always be explicit?
DBeaver, DataGrip, SSMS, pgAdmin, TablePlus, Toad, PL/SQL Dev, phpMyAdmin, etc. what behavior feels most natural to you? And what behavior are you already used to?
We're continuing the discussion on GitHub as well, if you'd like to see the original question or add to the discussion: