Skip to content

[Bug]: Splitter dropdown lists leading SQL comments as standalone statements #223

@debba

Description

@debba

What happened

When a SQL editor tab contains leading -- or /* */ comment blocks before a SELECT (or any other statement), the statement-splitting dropdown (next to the Run button) lists each leading comment line as its own entry alongside the actual statement.

Repro

Paste the following into a Console tab and open the run-selection dropdown:

-- ============================================
-- Any header comment block
-- ============================================
SELECT * FROM big_table ORDER BY id;  -- 500+ rows

The dropdown shows entries like -- ===… and -- 500+ rows in addition to the SELECT, even though they are not executable statements.

Expected

Leading/standalone comments should be merged into the following statement or filtered out — the dropdown should only list runnable statements.

Context

Splitting is delegated to dbgate-query-splitter, wired up in #119 (src/utils/sql.ts). The fix is either:

  1. Post-process the splitter output in splitQueries to drop entries that are comment-only / merge them into the next statement, or
  2. Configure / patch dbgate-query-splitter upstream if it exposes the right option.

Surfaced while working on #213 (pagination fix for SELECTs with leading comments).

Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
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