Skip to content

fix: handle SQL tool statements without result sets - #598

Open
Balrocj wants to merge 1 commit into
codefori:mainfrom
Balrocj:fix/copilot-sql-tool-ddl-result
Open

Balrocj wants to merge 1 commit into
codefori:mainfrom
Balrocj:fix/copilot-sql-tool-ddl-result

Conversation

@Balrocj

@Balrocj Balrocj commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the Copilot SQL runner tool when executing successful SQL statements that do not return a result set, such as CREATE TABLE, DROP TABLE, or CREATE ALIAS.

Previously, JobManager.runSQL() could return undefined. The tool passed JSON.stringify(undefined) into LanguageModelTextPart, which also evaluates to undefined and caused VS Code to throw an error when reading .length.

The tool now always returns a consistent JSON payload:

  • Statements without a result set: {"success":true,"hasResultSet":false,"rows":[]}
  • Statements with a result set: {"success":true,"hasResultSet":true,"rows":[...]}

Tests

  • Added regression tests for statements with and without result sets.
  • Manually verified successful CREATE TABLE and DROP TABLE statements through Copilot Chat.
  • npm test passes: 186 tests.
  • npm run typings passes.

Fixes #562

@buzzia2001

Copy link
Copy Markdown
Member

@Balrocj coul dyou please upload vsix?

@Balrocj

Balrocj commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@buzzia2001 I built the VSIX from this branch and attached it here for testing.

It includes the fix for SQL statements that complete successfully without returning a result set.

GitHub does not allow .vsix attachments, so the package is attached as a .zip.

vscode-db2i-2.1.1-dev.0.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vs Code db2i SQLRunnerTool issue on alias creation

2 participants