Skip to content

Automatic GO insertion after ; causes batch splitting issues #1158

Description

@WesleyDieterich

Bug Description

When executing SQL scripts that contain semicolons (;) as statement terminators, DBCode appears to automatically inject a GO batch separator after each semicolon. This behavior breaks scripts that rely on variables, since variable declarations must remain within the same batch in SQL Server.

Repro steps

  1. Open a SQL query editor connected to a SQL Server-compatible database (e.g., Fabric Warehouse)

  2. Write a script using variable declaration and semicolons, for example:

    DECLARE @x INT;
    SET @x = 1;
    SELECT @x;
    
  3. Execute the script using DBCode

  4. Observe that the script fails due to unintended batch separation

Expected Behavior

The script should be executed as a single batch, respecting semicolons as statement terminators only, without injecting GO statements automatically.

Actual Behavior

DBCode appears to split the script into multiple batches by injecting GO after semicolons, causing errors in scripts that depend on variables or batch-scoped constructs.

Environment

  • DBCode version: 1.35.8
  • VS Code (or fork) version: 1.127.0
  • OS: CachyOS and Windows 11
  • Database: Fabric Warehouse
  • Connection: Direct (SQL endpoint)

Error Meesages (if applicable)

Errors related to variable scope, such as:
"Must declare the scalar variable '@x'"

Screenshots

Image

Logs

DECLARE @x INT;
GO
SET @x = 1;
GO
SELECT @x;
[137] Must declare the scalar variable "@x". (line 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions