Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select SQL code and then Run Script, throws Compilation Error if code ends in single semicolon followed by comments #26416

Closed
MikeCSanJose opened this issue Apr 23, 2024 · 7 comments · Fixed by #26421
Assignees
Milestone

Comments

@MikeCSanJose
Copy link

Description

After upgrading to latest version this afternoon, the first script I tried to run (running fine last week) failed with error. I was able to isolate and repeat the issue. I am running over Snowflake. The simplified code below yields the same error.

Select either entire line below, then click "Execute SQL script", get the error below.
select 10 ; -- Comments
select 10 ; /* Comments */

Error occurred during SQL query execution
Reason:
SQL Error [1003] [42000]: SQL compilation error:
syntax error line 2 at position 0 unexpected 'LIMIT'.

Adding a second semicolon and the code runs fine:
select 10 ; ; -- Comments
select 10 ; ; /* Comments */

DBeaver Version

Community 24.0.3.202404211624

Operating System

Windows 10 Enterprise - 19045.4291

Database and driver

Snowflake JDBC driver

Steps to reproduce

Select either entire line below, then click "Execute SQL script", get the error below.
select 10 ; -- Comments
select 10 ; /* Comments */

Error occurred during SQL query execution
Reason:
SQL Error [1003] [42000]: SQL compilation error:
syntax error line 2 at position 0 unexpected 'LIMIT'.

Adding a SECOND semicolon and the code runs fine:
select 10 ; ; -- Comments
select 10 ; ; /* Comments */

Additional context

No response

@E1izabeth
Copy link
Member

Thank you for bug report.

@E1izabeth E1izabeth added xf:sql execution Queries execution and removed wait for review labels Apr 23, 2024
@E1izabeth
Copy link
Member

You could try switching Blank line is statement delimiter setting to Always
image

@E1izabeth E1izabeth self-assigned this Apr 23, 2024
@E1izabeth E1izabeth added this to the 24.0.4 milestone Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 23, 2024
…lation-error-if-code-ends-in-single-semicolon-followed-by-comments' of https://github.com/dbeaver/dbeaver into #26416-select-sql-code-and-then-run-script-throws-compilation-error-if-code-ends-in-single-semicolon-followed-by-comments
E1izabeth added a commit that referenced this issue Apr 23, 2024
@uslss uslss self-assigned this Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 23, 2024
E1izabeth added a commit that referenced this issue Apr 26, 2024
…t-sql-code-and-then-run-script-throws-compilation-error-if-code-ends-in-single-semicolon-followed-by-comments
serge-rider pushed a commit that referenced this issue Apr 26, 2024
…mart mode (#26421)

* #26416 Stop appending statements to the query on token delimiter in Smart mode

* #26416 Fix tests

* #26416 Add more unit tests

* #26416 Add more unit tests

* #26416 Fix tests

* #26416 Fix statement tail extraction when smart-expanding statements
@E1izabeth
Copy link
Member

The fix will be included in DBeaver 24.0.4.
Also you can try Early Access version with fix https://dbeaver.io/files/ea/ now.

@Moridin11
Copy link

I have tested this with 24.0.4 and I am still experiencing the issue

@jachincollins
Copy link

jachincollins commented May 6, 2024

I have tested this with 24.0.4 and I am still experiencing the issue

I am still experiencing this issue as well.

Edition	Windows 10 Enterprise
Version	22H2
Installed on	‎11/‎1/‎2021
OS build	19045.4170
Experience	Windows Feature Experience Pack 1000.19054.1000.0

@E1izabeth
Copy link
Member

Please provide examples to reproduce and create a new issue. This one is closed.

@MikeCSanJose
Copy link
Author

@E1izabeth - I submitted the original bug report. I'm now using Version 24.0.4.202405051837. Seems to be working for me. My only issue now is that my 24.0.3 "work-around" was to use double semi-colons to avoid the issue. When I have double semi-colons on 24.0.4, now I get an "Empty SQL Statement" error - which I expect and was how it was working prior to 24.0.3. Will be on the look-out for any remaining issues, and trying to remember to not use the double semi-colons anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants