Skip to content

Query History crashes after VS Code reload #305

Description

@bakinngTray

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:

  1. Connect to any PostgreSQL database.

  2. Run a query, for example:

    SELECT 1;
  3. Run Developer: Reload Window.

  4. 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-pgsql 1.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)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions