You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sqlite): columns with the same name collapse into one in query results #1144
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):
SELECTo.id, u.idFROM orders o JOIN users u ONu.id=o.user_idLIMIT1-- columns: ["id"], one value — expected two columnsSELECT o.*, u.*FROM orders o LEFT JOIN users u ONu.id=o.user_idORDER BYo.idLIMIT1 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).
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.*.
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):
Cause
SqliteConnection.executereturnsList<Map<String, Object?>>fromsqflite'srawQuery;SqliteSqlExecutionDelegate.executeQuerybuilds the column list fromresults.first.keysand reads cells by name. Equal names map to one key. Same class of bug as the ERD catalog fixed in #1139.Affected
*with repeated names,SELECT 1, 1, expressions without aliases that print the same).run_query/sample_rowson SQLite connections (epic(mcp): Querya Desktop as a read-only MCP server #1133).Fix ideas
sqflite'sQueryResultSetkeepscolumns/rowsinternally; or run read queries throughpackage:sqlite3(ResultSet.columnNames+rows), whichsqflite_common_ffialready depends on.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.SELECT 1, 1,o.*, u.*.