Description:
When running a selected statement in the SQL Editor, if the selection extends past the semicolon into the trailing whitespace, the editor also executes the next statement, even though no part of it is selected.
Expected result: Only the selected statement is executed.
Actual result: The Output panel reports "2 statements executed". The second statement is also executed.
When the selection ends exactly at the semicolon, only the selected statement runs, as expected.
Impact: A user may unintentionally execute destructive statements (such as DELETE or DROP TABLE) that were not selected.
How to repeat:
How to repeat:
In the SQL Editor, write two statements on separate lines:
SELECT * FROM table_a;
CREATE TABLE table_b (id INT);
Select only the first statement, letting the selection end one space after the semicolon (without selecting any character of the second line).
Click Run.
Suggested fix:
Ignore trailing whitespace after the semicolon when determining which statements are included in the selection.