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(erd): the Diagram tab reads the catalog through the SQL editor session (implicit BEGIN, aborted transactions, LIMIT 5000) #1218
The SQL workspace's Diagram tab reads the catalog through the SQL editor's own session and its result-grid rules.
ErdView(source: SqlErdSource(delegate: widget.delegate, ...)) (lib/features/workspace/generic_sql_workspace.dart:1212): the catalog goes through the editor's SqlExecutionDelegate, i.e. the editor's readWrite session (or readOnly for read-only connections).
ErdCatalog.load / loadNeighbourhood call delegate.executeQuery(...) without a limit (lib/features/erd/erd_catalog.dart:108-109, :121).
Consequences:
PostgreSQL, manual commit:PostgresSqlExecutionDelegate.executeQuery sends BEGIN when no transaction is open (lib/features/postgresql/postgres_sql_workspace.dart:97-102). Opening or refreshing the diagram therefore opens a transaction in the editor. The toolbar shows "Transaction open", and closing the workspace or connection warns about an open transaction the user never started.
Aborted editor transaction: if the editor's transaction failed, every catalog query fails with "current transaction is aborted, commands ignored until end of transaction block", and the diagram shows "Could not load the schema".
Silent truncation: without a limit, executeQuery injects LIMIT kDefaultSqlResultMaxRows = 5000 (lib/core/storage/app_settings.dart:11, postgres_sql_workspace.dart:94; MySQL and SQLite delegates do the same). The columns query returns one row per column, ordered by table name, so a schema with more than 5000 columns loses the tables at the end of the alphabet, or shows them with missing columns, without any notice. MCP reads the same catalog with a limit of 200 000.
The Relations view in the table browser is not affected by 1, 2 and 4: it uses TableDataSqlAdapter → loadCustomSql (no limit, no BEGIN) on the read-only session.
Scope
The Diagram tab gets its own read-only ErdSource: a catalog delegate on a read-only session (the pool's readOnly slot, or a dedicated catalog slot), not the editor's delegate.
Catalog queries never go through the editor's implicit BEGIN or the result-grid limit. Use an explicit catalog limit (like MCP's 200 000) and show a notice in the diagram when the catalog hits it.
The editor's transaction state, running query and badge stay untouched by the diagram.
Acceptance
PostgreSQL, manual commit: opening and refreshing the Diagram sends no BEGIN on the editor session, and the transaction badge does not change (fake delegate test).
With the editor's transaction aborted, the diagram still loads.
A fake catalog of 6 000 column rows renders every table; a catalog over the explicit limit shows a truncation notice.
Part of #1212.
Problem
The SQL workspace's Diagram tab reads the catalog through the SQL editor's own session and its result-grid rules.
ErdView(source: SqlErdSource(delegate: widget.delegate, ...))(lib/features/workspace/generic_sql_workspace.dart:1212): the catalog goes through the editor'sSqlExecutionDelegate, i.e. the editor'sreadWritesession (orreadOnlyfor read-only connections).ErdCatalog.load/loadNeighbourhoodcalldelegate.executeQuery(...)without a limit (lib/features/erd/erd_catalog.dart:108-109,:121).Consequences:
PostgresSqlExecutionDelegate.executeQuerysendsBEGINwhen no transaction is open (lib/features/postgresql/postgres_sql_workspace.dart:97-102). Opening or refreshing the diagram therefore opens a transaction in the editor. The toolbar shows "Transaction open", and closing the workspace or connection warns about an open transaction the user never started.executeQueryinjectsLIMIT kDefaultSqlResultMaxRows= 5000 (lib/core/storage/app_settings.dart:11,postgres_sql_workspace.dart:94; MySQL and SQLite delegates do the same). The columns query returns one row per column, ordered by table name, so a schema with more than 5000 columns loses the tables at the end of the alphabet, or shows them with missing columns, without any notice. MCP reads the same catalog with a limit of 200 000.The Relations view in the table browser is not affected by 1, 2 and 4: it uses
TableDataSqlAdapter→loadCustomSql(no limit, no BEGIN) on the read-only session.Scope
ErdSource: a catalog delegate on a read-only session (the pool'sreadOnlyslot, or a dedicated catalog slot), not the editor's delegate.BEGINor the result-grid limit. Use an explicit catalog limit (like MCP's 200 000) and show a notice in the diagram when the catalog hits it.Acceptance
BEGINon the editor session, and the transaction badge does not change (fake delegate test).