microsoft / microsoft/vscode-mssql
[Bug]: Peek Definition editor is connected to the active database and allows query execution
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 610
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 97
Description
### Description
The inline Peek Definition editor establishes a connection to the active database, even though the editor is read-only and displays the CREATE script for an object that already exists.
Because of this, the standard query execution shortcut (Ctrl+E) will execute the displayed CREATE statement from the Peek Definition editor. That execution fails with expected SQL errors such as "object already exists" and related constraint/default errors.
Expected behavior
The Peek Definition editor should be treated as a disconnected, non-executable definition viewer. It should not establish a database connection and should not respond to query execution shortcuts such as Ctrl+E.
Actual behavior
The Peek Definition editor is connected to the active database and allows execution of the displayed script, which results in failed CREATE statements.
Why this is a bug
Peek Definition is a read-only inspection surface, not an editable query document. Executing its contents is not useful and leads to confusing errors.
### Steps to Reproduce
1. Open a connected editor with a select
2. Peek Definition on a table listed in the FROM clause
Expected: Peek Definition popup window is disconnected
Actual: It's connect and it executes and fails
### Affected Area
- [ ] Connection dialog (SQL Server | Azure browse/Fabric browse)
- [x] Query editor
- [ ] Query results panel
- [ ] Object Explorer
- [ ] GitHub Copilot integration
- [ ] Preview/Edit data
- [ ] Table Designer
- [ ] Schema Designer
- [ ] Schema Compare
- [ ] Local SQL Server Container provisioning
- [ ] SQL database in Fabric provisioning
- [ ] DACPAC/BACPAC export/import
- [ ] SQL Database projects
- [ ] Query Plan Visualizer
- [ ] Other (please describe below)
### If you selected "Other", please describe the affected area
_No response_
### Environment Information
Latest
### Confirmation
- [x] I have searched existing issues and couldn't find a match
- [ ] I want to work on this issue
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.