Skip to content

Blank lines split a single SQL statement in the query editor #281

Description

@humbledude

Summary

A blank line in a multi-line query causes the query editor to execute the text after the blank line as a separate SQL statement.

Steps to reproduce

  1. Connect to any database in sqlit.
  2. Enter the following query:
SELECT *
FROM schema_name.table_name
WHERE id < 1000

LIMIT 10
  1. Run the query from the editor.

Expected behavior

Blank lines are whitespace only, so the full query should be executed as one SQL statement.

Actual behavior

sqlit treats the blank line as a statement boundary. It runs the SELECT ... WHERE ... portion and then attempts to execute LIMIT 10 separately.

Notes

The same query works when the blank line before LIMIT 10 is removed. This makes normal SQL formatting with visual spacing difficult to use.

Suggested behavior

Could statement execution use one of these approaches instead?

  • Split statements only on a SQL delimiter such as ;.
  • Execute the statement containing the cursor, using SQL-aware parsing.
  • Execute selected text when there is an active selection.
  • Provide a configuration option for the statement separator/execution strategy.

This would allow users to retain normal formatting, including blank lines between clauses or CTEs, without changing query execution behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions