Repository navigation
Conversation
The server returns the rows, the affected row count, or the Postgres error of pgls.executeStatement. A middleware on workspace/executeCommand renders it in a webview beside the editor, including truncation and a link to the error position in the document.
psteinroe
force-pushed
the
feat/render-statement-results
branch
from
October 26, 2026 19:38
a267bb7 to
722998b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since supabase-community/postgres-language-server#879,
pgls.executeStatementreturns the result of the statement instead ofnull: the columns and up to 100 rows (values in their Postgres text form,nullfor SQLNULL), atruncatedflag,rowsAffectedfor statements that return no rows, and, since supabase-community/postgres-language-server#903, the Postgres error with SQLSTATE, detail, hint and its position in the document. The extension ignored that value, so the only feedback was the server's one-lineshowMessage.This adds a
Statement Resultwebview beside the editor. A middleware onworkspace/executeCommandlets every command through unchanged and, forpgls.executeStatement, renders what the server returned:NULLshown asNULL, and a note when the result was truncated,The panel is created on the first execution and reused, and it doesn't take focus. It runs one small script, behind a nonce-based CSP, that only posts the "reveal" message for the error link. Older servers return
null, which is ignored, so nothing changes for them.truncatedValues, which the guard in supabase-community/postgres-language-server#920 adds, is shown as a note when present. The notices that the server collects with that change end up in the summary message, so they show up without extra handling.The README gets a section on executing statements.
How I tested it:
npm run compile,npm run lintandnpm run packagepass. I ran the extension in VS Code 1.140 (under Xvfb) against a server built from main and a local Postgres, with a script in the extension host that runs the "Execute Statement" code action:select ... from generate_series(1, 150)shows 100 rows, theNULLs and the truncation note,select 'ä' as a, missing_column from pg_classon line 4 shows42703at "Line 4, column 18", and clicking the link puts the cursor there,create temp table ...shows "Rows affected: 0",pgls.executeStatementwithout arguments shows theInvalidParamsmessage from the server.