Skip to content

fix(sqlite): columns with the same name collapse into one in query results #1144

Description

@ZhuchkaTriplesix

Problem

A SQLite result with two columns of the same name shows only one of them, and its values may come from the other column. No error, the user just sees wrong data.

Reproduced on the demo database (via MCP, same path as the SQL editor):

SELECT o.id, u.id FROM orders o JOIN users u ON u.id = o.user_id LIMIT 1
-- columns: ["id"], one value — expected two columns
SELECT o.*, u.* FROM orders o LEFT JOIN users u ON u.id = o.user_id ORDER BY o.id LIMIT 1 OFFSET 11
-- shows id = 2 (users.id) and users.created_at for order 12

Cause

SqliteConnection.execute returns List<Map<String, Object?>> from sqflite's rawQuery; SqliteSqlExecutionDelegate.executeQuery builds the column list from results.first.keys and reads cells by name. Equal names map to one key. Same class of bug as the ERD catalog fixed in #1139.

Affected

  • SQL editor results for SQLite (any JOIN / * with repeated names, SELECT 1, 1, expressions without aliases that print the same).
  • MCP run_query / sample_rows on SQLite connections (epic(mcp): Querya Desktop as a read-only MCP server #1133).
  • Anything else that reads SQLite rows by name (table browser, export of such results).

Fix ideas

  • Read results positionally: column list + rows as lists. Options: sqflite's QueryResultSet keeps columns / rows internally; or run read queries through package:sqlite3 (ResultSet.columnNames + rows), which sqflite_common_ffi already depends on.
  • Keep display names as SQLite reports them (id, id); the grid already uses positions.

Acceptance

  • SELECT o.id, u.id ... returns two columns with the right values in the SQL editor and over MCP.
  • Regression tests on a real SQLite file: duplicate names, SELECT 1, 1, o.*, u.*.
  • No change for results with unique names.

Activity

  1. added
    bugSomething isn't working
    sqliteSQLite database driver and workspace
    data-gridInteractive data grid, cell editor, filtering, groupings
    P1High priority / Core capability
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priority / Core capabilitybugSomething isn't workingdata-gridInteractive data grid, cell editor, filtering, groupingssqliteSQLite database driver and workspace

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions