hankinsoft / SQLPro

SQLPro bug & features tracking.
104 stars 27 forks source link

"BEGIN TRANSACTION;" not evaluated as an independent statement for "cursor range" execution. #986

Open blak3r opened 4 months ago

blak3r commented 4 months ago

Describe the bug BEGIN; and BEGIN TRANSACTION; are not detected as independent sql statements when using "cursor range" execution. This can lead to running statements following it that you didn't intend.

The workaround is to select the text and press "Run Selected" button in upper right. It all feels really scary when you're doing a transaction against your production database.

ROLLBACK TRANSACTION; / COMMIT TRANSACTION and their shorthand variants are properly detected.

To Reproduce The following gif shows how in the UI when you click BEGIN TRANSACTION; the UPDATE statement below is also selected. If you were to press enter, both would get executed. 2024-05-31_12-40-29 (1)

This behavior has been present for several years (it's not a recent regression). Just finally taking the time to report it ;)

Expected behavior Only BEGIN; is selected when the cursor is on that line. And only that statement should be run on enter.

Environment details (please complete the following information): SQLPro Studio Version 2024.11 (Build 111082) MacOS Monterey v12.7.1 SETAPP POSTGRES Database.

image

hankinsoft commented 4 months ago

Hmmm, I'm investigating this to see what I can come up with.

blak3r commented 2 months ago

Had a scare with this functionality today again. Thankfully my query was ok. Something like this occurred.

2024-07-26_14-56-34 (1)