microsoft / microsoft/vscode-pgsql
Query History crashes after VS Code reload
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 395
- Forks
- 33
- Avg merge
- 1h 46m
- Merged PRs (30d)
- 3
Description
Describe the bug
The PostgreSQL extension successfully connects to the database, displays the
Object Explorer, executes SQL queries, and shows query results. However, the
Query History command fails after VS Code is reloaded if at least one query was
executed before the reload.
To Reproduce
Steps to reproduce the behavior:
-
Connect to any PostgreSQL database.
-
Run a query, for example:
SELECT 1; -
Run
Developer: Reload Window. -
Run
PGSQL: Open Query History in Command Palette.
Actual result
VS Code displays the following error:
Command 'PGSQL: Open Query History in Command Palette' resulted in an error
Cannot read properties of undefined (reading 'length')
The Query History view cannot be opened. Clearing the history removes existing
entries, but the same error returns after executing another query and reloading
VS Code.
Expected behavior
Query History should open successfully and display queries executed before the
VS Code reload.
VS Code version
- Extension:
ms-ossdata.vscode-pgsql1.30.1 - VS Code: 1.136.2
- Operating system: Windows
- Database: PostgreSQL, connected through PgBouncer
Extension Logs
2026-09-09 16:18:31.101 [error] TypeError: Cannot read properties of undefined (reading 'length')
at limitStringSize (C:\\Users\\<username>\\.vscode\\extensions\\ms-ossdata.vscode-pgsql-1.30.1-win32-x64\\dist\\extension.js:72:24815)
at QueryHistoryUI.convertToQuickPickItem (C:\\Users\\<username>\\.vscode\\extensions\\ms-ossdata.vscode-pgsql-1.30.1-win32-x64\\dist\\extension.js:330:3142)
at Array.map (<anonymous>)
at QueryHistoryProvider.showQueryHistoryCommandPalette (C:\\Users\\<username>\\.vscode\\extensions\\ms-ossdata.vscode-pgsql-1.30.1-win32-x64\\dist\\extension.js:330:5423)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the QueryHistoryUI.convertToQuickPickItem and limitStringSize entry points named in the extension log, then trace how query history is restored after Developer: Reload Window. Reproduce with SELECT 1 and verify that PGSQL: Open Query History displays the saved query after reload without the undefined-length error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100