feat(pam): add SQL runner in data explorer#5954
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
- Add dynamic query tabs (Browse + closeable query tabs) with "New query" button - Add CodeMirror 6 SQL editor with PostgreSQL syntax highlighting and Cmd+Enter shortcut - Add resizable split pane between editor and results - Reuse DataGrid component for query results with PK/FK/type metadata from tableDetail - Show meaningful mutation messages (N rows inserted/updated/deleted) for non-SELECT queries - Handle multi-statement queries by returning the last result (same as psql) - Cap query results at 1000 rows server-side to prevent memory exhaustion - Auto-switch to Browse tab when clicking a table in the sidebar - Remove PamAccountAccessPage for Postgres (replaced by data explorer); restore it for SSH and Redis
1eb6e6f to
9460485
Compare
…r and query panel
ad63915 to
5a4fc6c
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Greptile SummaryThis PR adds a SQL query runner to the PAM Data Explorer, unifying table browsing and ad-hoc SQL execution into a single tabbed interface. The backend change handles multi-statement queries and caps row results at 1,000; new frontend components (
Confidence Score: 4/5Safe to merge with one P1 UX bug where the displayed row count can be far larger than what users can actually access. The rowCount mismatch is a present defect on the primary query path — the toolbar reports the original PostgreSQL row count while rows are truncated to 1,000 (then 500) before display. All other findings are P2 style/quality concerns that don't block correctness. backend/src/ee/services/pam-web-access/pam-postgres-session-handler.ts — rowCount should reflect actual rows sent, not the pre-truncation total Important Files Changed
|
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9db123d2fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…to SQL query runner - Cancel query via pg_cancel_backend on a separate connection - Commit/Rollback buttons with transaction open badge when BEGIN detected - Run Selection: executes selected text via button or Cmd+Enter - Result pane shows contextual messages for BEGIN/COMMIT/ROLLBACK - Fix Run button passing MouseEvent as SQL argument
…rows Backend now sends isTruncated flag alongside rowCount so the toolbar can display "Showing 1,000 of X rows" instead of the misleading raw DB count.
…ry errors Backend now tracks transaction state across all results in a multi-statement batch (e.g. BEGIN; INSERT ...) and resets it on error since ROLLBACK is always issued. The authoritative transactionOpen flag is sent with every QueryResult so the frontend no longer misreads the last command or fails to clear state on error.
… shared utility Apply [&::-webkit-scrollbar]:h-1 as a scoped Tailwind arbitrary variant on the specific tab bar element instead of adding height to the shared thin-scrollbar utility (which caused lint to reorder the class in 50+ unrelated files). Also remove unused tableMeta prop from DataGridContextMenu ContextMenuImpl and add SQL query runner screenshot to docs.
…or, status bar, contrast improvements
…move PK/FK indicators from query tabs
…ia PamAccountAccessPage
Split multi-statement SQL using the real PostgreSQL C parser (libpg-query WASM), then run each statement through pg-cursor which uses the Extended Query Protocol to cap rows at the wire level. Removes the buffered query path entirely so memory usage is bounded regardless of result set size.
Context
This implements a SQL runner and unifies the data explorer and terminal view into one view. It lets you create multiple tabs to run multiple SQL queries. Select, insert, update, and delete queries are all supported.
Screenshots
Screen.Recording.2026-04-06.at.5.50.33.PM.mov
Steps to verify the change
Type
Checklist
type(scope): short description(scope is optional, e.g.,fix: prevent crash on syncorfix(api): handle null response).