brewDB SQL Editor & LSP
The brewDB SQL editor is built on Monaco (the editor that powers VS Code) and connects to a live postgres-language-server sidecar over WebSocket. The legacy application had no SQL editor at all, let alone a language server — this is entirely new.
The key design point is that the language server connection is pinned to your own database role, brew_user_<profile_id>, not a shared or admin role. That means every suggestion the editor offers — a table name, a column, a function signature — reflects tables and columns you’re actually permitted to see. You won’t be prompted to complete a query against a table you can’t query, and hover info won’t leak the shape of data you don’t have access to.
Autocomplete & Hover
Section titled “Autocomplete & Hover”As you type, the editor requests completions from the language server: table names, column names, and function signatures scoped to your brew_user_<profile_id> role’s actual grants. Hovering over an identifier shows its type — useful for confirming a column’s type before you write a WHERE clause or cast against it.
Diagnostics & Linting
Section titled “Diagnostics & Linting”The language server reports diagnostics inline as you write a query, catching syntax problems before you run anything. On top of that, brewDB layers a read-only linter that specifically flags writes and DDL — INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, and the like — so you get a clear signal before executing a statement that would change data or schema rather than just read it.
Formatting
Section titled “Formatting”The editor can reformat a query’s SQL for you, which is useful both for readability and for cleaning up queries pasted in from elsewhere.