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
Fix schema-aware SQL execution, linting, and Studio navigation so SQL queries and diagnostics resolve unqualified identifiers against the selected schema instead of always relying on the adapter default schema.
Copy file name to clipboardExpand all lines: Architecture/sql-editor-intelligence.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,9 @@ This architecture governs:
51
51
- stale responses MUST be discarded via request id check
52
52
- Diagnostics MUST be clamped to document bounds before returning to CodeMirror.
53
53
- Empty SQL MUST short-circuit with no lint request.
54
+
- SQL editor language configuration and lint requests MUST use the active URL
55
+
schema as the default schema so completions and diagnostics match the schema
56
+
selector.
54
57
- Table-level SQL filter pills MAY reuse the same adapter `sqlLint` transport, but they MUST wrap raw `WHERE` fragments in a full `SELECT ... WHERE ...` statement before linting.
55
58
- SQL filter-pill linting MUST run asynchronously in the background and MUST NOT block the initial filter apply interaction.
56
59
- Table-level SQL filter-pill lint diagnostics are advisory UI state only and MUST NOT mutate the already-applied URL filter after the pill has been saved.
@@ -61,6 +64,8 @@ This architecture governs:
61
64
- existing `customHeaders`
62
65
- existing `customPayload`
63
66
- Procedure name for linting is `sql-lint`.
67
+
- Lint request payloads MAY include `schema`; when present, the backend MUST
68
+
plan unqualified identifiers against that schema.
64
69
- New SQL-editor surfaces MUST NOT bypass BFF auth propagation.
65
70
- Executor contract:
66
71
-`Executor` MAY expose `lintSql(details, options)` as an optimized lint transport.
@@ -79,6 +84,7 @@ This architecture governs:
79
84
-`statement_timeout = 1000ms`
80
85
-`lock_timeout = 100ms`
81
86
-`idle_in_transaction_session_timeout = 1000ms`
87
+
- transaction-local `search_path` when a selected schema is provided
82
88
83
89
On Postgres errors, diagnostics MUST include mapped position and SQLSTATE when available. Timeout diagnostics (`57014`) MUST be rewritten to a user-facing lint-timeout message.
84
90
For multi-statement SQL text, diagnostics MUST map statement-relative positions back to full-editor offsets.
Copy file name to clipboardExpand all lines: FEATURES.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,6 +208,7 @@ Matching substrings are highlighted in the grid, and timeout errors explain that
208
208
209
209
The SQL view uses a full CodeMirror editor with dialect-aware syntax highlighting and schema-aware autocomplete for schemas, tables, and columns.
210
210
Autocomplete is built from live introspection metadata, so suggestions track the current database structure without manual refresh workflows.
211
+
The active schema selector is also used as the default SQL namespace, so unqualified queries like `select * from order_items` run and lint against the selected schema instead of always resolving through `public`.
211
212
PostgreSQL, MySQL, and SQLite linting runs asynchronously through guarded parse/plan `EXPLAIN` paths and shows inline diagnostics while preserving the normal run/cancel query flow.
212
213
The same lint transport also validates saved table-level SQL filter pills in the background, so Studio reuses one dialect-aware SQL validation path for both the SQL editor and advanced inline table filters.
213
214
Keyboard execution supports `Cmd/Ctrl+Enter`, and in multi-statement scripts it runs only the top-level statement at the current cursor.
Copy file name to clipboardExpand all lines: README.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -363,6 +363,7 @@ type StudioBFFRequest =
363
363
| {
364
364
procedure:"query";
365
365
query:Query;
366
+
schema?:string;
366
367
customPayload?:Record<string, unknown>;
367
368
}
368
369
| {
@@ -378,6 +379,7 @@ type StudioBFFRequest =
378
379
| {
379
380
procedure:"sql-lint";
380
381
sql:string;
382
+
schema?:string;
381
383
schemaVersion?:string;
382
384
customPayload?:Record<string, unknown>;
383
385
}
@@ -419,10 +421,10 @@ type QueryInsightsResponse =
419
421
420
422
### Procedure Semantics
421
423
422
-
-`query`: execute one SQL statement. This is required for every Studio adapter.
424
+
-`query`: execute one SQL statement. This is required for every Studio adapter. Requests may include `schema`; when present, use it as the default namespace for unqualified identifiers.
423
425
-`sequence`: execute exactly two queries in order. This is used by MySQL write flows that update first and refetch second.
424
426
-`transaction`: execute an ordered list of queries inside one database transaction. This is the contract addition that enables atomic staged multi-row saves from the table editor.
425
-
-`sql-lint`: return parse/plan diagnostics for the SQL editor and SQL-backed filter pills.
427
+
-`sql-lint`: return parse/plan diagnostics for the SQL editor and SQL-backed filter pills. Requests may include `schema`; diagnostics should plan unqualified identifiers against that selected schema.
426
428
-`query-insights`: return a live query snapshot for the optional `Queries` view.
427
429
428
430
For `sequence`, the second query should only run if the first one succeeds. For `transaction`, the response result array must stay in the same order as `body.queries`.
0 commit comments