dbgate
dbgate copied to clipboard
BUG: Run Current doesn't work as expected when there's only one query.
Describe the bug When there is only one query in the buffer, "Run Current" will run the current line instead of the current query.
To Reproduce Steps to reproduce the behavior:
- Open a new query.
- Create a single multiline query.
- Trigger
Run Current
- DbGate will send the individual line that the cursor is on instead of the entire query, usually resulting in a syntax error.
Expected behavior The entire query should be run. "Current" should mean the current query, and DbGate should send the entire multiline query to the DB to execute. II previously asked about this issue in #743 But have sinced realized that it only occurs when there is only one query.
Screenshots
If applicable, add screenshots to help explain your problem.
Run current when cursor is on line 4.
Run current with same query highlighted.
Run current behaves correctly when there are multiple queries.
Version Information (please complete the following information):
- OS: Linux Arch
- App Version: 5.2.7
- Install source: AUR
- Type: Application
- Database engine: PostgresSQL
Hmm yes that sounds like a bug. Execute current should ideally execute the currently highlighted query, even if it does span across multiple lines.
From my point of view, running only current line is more flexible and more safe solution. It could be use also in case of more single-line queries
If user needs to run the entire query, he could use "Run" command
From my point of view, running only current line is more flexible and more safe solution. It could be use also in case of more single-line queries
If user needs to run the entire query, he could use "Run" command
If this behavior is chosen, I would expect it to be consistent. Currently, buffers with multiple queries behave as expected, where run current runs the current query. This is also how every DB client I've used behaves, and IMO is much more useful than the alternative.
I've added some screenshots to show what's happening.
I understand your point
However, I am not sure that running entire query is safe. There is possibility, that query uses some nonstandard delimiters and dbgate's detection of query segments will result into one query. Then running the entire query could cause some damage, if user expects running of query part.
Safe option could be to ask user, whether to run the entire query, when no parts were detected and he will execute "Run current" command