Skip to content

List of connected servers is not loaded properly when executing a query before loading the servers #242

@Kaiden42

Description

@Kaiden42

Describe the bug

When I connect to a server through a SQL file before opening the PostgreSQL Activity, only the current connected server is listed on the PostgreSQL activity.

To Reproduce

Steps to reproduce the behavior:

  1. Open a Workspace in VS Code
  2. Click on the PostgreSQL Activity -> All stored connections are listed
Image
  1. Close the Workspace
  2. Reopen the Workspace but stay in the file Explorer
  3. Open a SQL file
  4. Use the SQL file to open a connection to a server
Image
  1. Click on the PostgreSQL Activity -> Only the connected server is listed
Image

Expected behavior

I would expect to always see all my stored connections on the PostgreSQL Activity.

VS Code version

Version: 1.112.0 (user setup)
Commit: 07ff9d6178ede9a1bd12ad3399074d726ebe6e43
Date: 2026-03-17T18:09:23Z
Electron: 39.8.0
ElectronBuildId: 13470701
Chromium: 142.0.7444.265
Node.js: 22.22.0
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26100

Using version 1.18.2 of the extension
Image

Extension Logs

PGSQL: Show Extension Logs
Steps 1 & 2

[10:55:40 AM] [PgToolsService Initialization] ServiceDownloadProvider initialized
[10:55:40 AM] [PgToolsService Initialization] [All]: Initializing PostgreSQL Tools Service for the pgsql extension.
[10:55:40 AM] [PgToolsService Initialization] [All]: Note: pgsql commands will be available after installing the service.
[10:55:40 AM] [PgToolsService Initialization] [All]: 
[10:55:40 AM] [PgToolsService Initialization] Platform: linux, x86_64, name=fedora, version=42[All]:  (Fedora)
[10:55:40 AM] [PgToolsService Initialization] [All]: 
[10:55:40 AM] [PgToolsService Initialization] [All]: Checking server path for runtime ID: Fedora_23
[10:55:40 AM] [PgToolsService Initialization] [All]: Tools Service path: /home/user/.vscode-server/extensions/ms-ossdata.vscode-pgsql-1.18.2/pgsqltoolsservice/v3.0.2/Linux_x64/pgsqltoolsservice/ossdbtoolsservice_main
[10:55:40 AM] [PgToolsService Initialization] [All]: 
**************************************************
PG Tools Service log path can be found at:
/home/user/.vscode-server/data/logs/20260325T105534/exthost1/ms-ossdata.vscode-pgsql/pgsql-tools.log
**************************************************

[10:55:40 AM] [PgToolsService Initialization] [All]: Initializing language client
[10:55:40 AM] [PgToolsService Initialization] [All]: Checking overrides for language client initialization
[10:55:40 AM] [PgToolsService Initialization] [All]: Creating the language client with options: {"command":"/home/user/.vscode-server/extensions/ms-ossdata.vscode-pgsql-1.18.2/pgsqltoolsservice/v3.0.2/Linux_x64/pgsqltoolsservice/ossdbtoolsservice_main","args":["--log-file","/home/user/.vscode-server/data/logs/20260325T105534/exthost1/ms-ossdata.vscode-pgsql/pgsql-tools.log","--parent-pid","8880","--mcp-mode","vscode-extension","--vscode-flavor","vscode","--application-name","Code","--data-path","/home/user/.config","--enable-sql-authentication-provider","--log-level","info","--instrumentation-key","...","--vscode-machine-id","...","--vscode-session-id","...","--vscode-extension-version","1.18.2","--vscode-version","1.112.0"],"transport":0}
[10:55:40 AM] [PgToolsService Initialization] [All]: Language client created
[10:55:40 AM] [PgToolsService Initialization] [All]: Starting language client
[10:55:40 AM] [PgToolsService Initialization] [All]: Language client started
[10:55:40 AM] [PgToolsService Initialization] [All]: Waiting for client to be ready
[10:55:43 AM] [PgToolsService Initialization] [All]: Client is ready
[10:55:43 AM] [McpNotificationHandler] Registered MCP notification handlers
[10:55:43 AM] [MetricsService] [All]: MetricsService initialized
[10:55:43 AM] [serverDashboard] [Verbose]: Azure metadata service initialized for Server Dashboard
[10:55:43 AM] [ToolsService] [Information]: ToolsService: registerTools called
[10:55:43 AM] [ToolsService] [Information]: Registering LMT: pgsql_migration_oracle_app
[10:55:43 AM] [ToolsService] [Information]: Registering LMT: pgsql_migration_show_report
[10:55:43 AM] [ToolsService] [Information]: MCP available - filtered 14 tools with MCP equivalents
[10:55:43 AM] [mainController] [All]: Azure Deployments view registered
[10:55:43 AM] [mainController] [All]: Resuming deployment tracker with 0 staged profile(s)
[10:55:43 AM] [mainController] [All]: Resume summary: no active deployments (pending: 0, deploying: 0, succeeded: 0, failed: 0)
[10:55:43 AM] Initializing MCP service...
[10:55:43 AM] [MigrationProjectService] [Information]: No postgres-migrations folder found in sqls: Error: ENOENT: no such file or directory, stat '/home/user/ws/project/sqls/.github/postgres-migrations/'
[10:55:43 AM] MCP server registered with VS Code at http://127.0.0.1:36875/mcp
[10:55:43 AM] MCP tool handlers registered
[10:55:43 AM] MCP service initialized successfully
[10:55:43 AM] [MigrationProjectService] [Information]: No postgres-migrations folder found in sqls: Error: ENOENT: no such file or directory, stat '/home/user/ws/project/sqls/.github/postgres-migrations/'
[10:55:51 AM] [ObjectExplorerService] [All]: Getting root OE nodes
[10:55:51 AM] [PgToolsService Initialization] [Verbose]: readAllConnections: 4 connections; excluded recent)
[10:55:51 AM] [PgToolsService Initialization] [Verbose]: readAllConnections: 4 connections; excluded recent)
[10:55:51 AM] [ObjectExplorerService] [All]: Created OE root with 1

Steps 4 to 7

[11:00:53 AM] [PgToolsService Initialization] ServiceDownloadProvider initialized
[11:00:53 AM] [PgToolsService Initialization] [All]: Initializing PostgreSQL Tools Service for the pgsql extension.
[11:00:53 AM] [PgToolsService Initialization] [All]: Note: pgsql commands will be available after installing the service.
[11:00:53 AM] [PgToolsService Initialization] [All]: 
[11:00:53 AM] [PgToolsService Initialization] Platform: linux, x86_64, name=fedora, version=42[All]:  (Fedora)
[11:00:53 AM] [PgToolsService Initialization] [All]: 
[11:00:53 AM] [PgToolsService Initialization] [All]: Checking server path for runtime ID: Fedora_23
[11:00:53 AM] [PgToolsService Initialization] [All]: Tools Service path: /home/user/.vscode-server/extensions/ms-ossdata.vscode-pgsql-1.18.2/pgsqltoolsservice/v3.0.2/Linux_x64/pgsqltoolsservice/ossdbtoolsservice_main
[11:00:53 AM] [PgToolsService Initialization] [All]: 
**************************************************
PG Tools Service log path can be found at:
/home/user/.vscode-server/data/logs/20260325T110048/exthost1/ms-ossdata.vscode-pgsql/pgsql-tools.log
**************************************************

[11:00:53 AM] [PgToolsService Initialization] [All]: Initializing language client
[11:00:53 AM] [PgToolsService Initialization] [All]: Checking overrides for language client initialization
[11:00:53 AM] [PgToolsService Initialization] [All]: Creating the language client with options: {"command":"/home/user/.vscode-server/extensions/ms-ossdata.vscode-pgsql-1.18.2/pgsqltoolsservice/v3.0.2/Linux_x64/pgsqltoolsservice/ossdbtoolsservice_main","args":["--log-file","/home/user/.vscode-server/data/logs/20260325T110048/exthost1/ms-ossdata.vscode-pgsql/pgsql-tools.log","--parent-pid","9525","--mcp-mode","vscode-extension","--vscode-flavor","vscode","--application-name","Code","--data-path","/home/user/.config","--enable-sql-authentication-provider","--log-level","info","--instrumentation-key","...","--vscode-machine-id","...","--vscode-session-id","...","--vscode-extension-version","1.18.2","--vscode-version","1.112.0"],"transport":0}
[11:00:53 AM] [PgToolsService Initialization] [All]: Language client created
[11:00:53 AM] [PgToolsService Initialization] [All]: Starting language client
[11:00:53 AM] [PgToolsService Initialization] [All]: Language client started
[11:00:53 AM] [PgToolsService Initialization] [All]: Waiting for client to be ready
[11:00:57 AM] [PgToolsService Initialization] [All]: Client is ready
[11:00:57 AM] [McpNotificationHandler] Registered MCP notification handlers
[11:00:57 AM] [MetricsService] [All]: MetricsService initialized
[11:00:57 AM] [serverDashboard] [Verbose]: Azure metadata service initialized for Server Dashboard
[11:00:57 AM] [ToolsService] [Information]: ToolsService: registerTools called
[11:00:57 AM] [ToolsService] [Information]: Registering LMT: pgsql_migration_oracle_app
[11:00:57 AM] [ToolsService] [Information]: Registering LMT: pgsql_migration_show_report
[11:00:57 AM] [ToolsService] [Information]: MCP available - filtered 14 tools with MCP equivalents
[11:00:57 AM] [mainController] [All]: Azure Deployments view registered
[11:00:57 AM] [mainController] [All]: Resuming deployment tracker with 0 staged profile(s)
[11:00:57 AM] [mainController] [All]: Resume summary: no active deployments (pending: 0, deploying: 0, succeeded: 0, failed: 0)
[11:00:57 AM] Initializing MCP service...
[11:00:57 AM] [MigrationProjectService] [Information]: No postgres-migrations folder found in sqls: Error: ENOENT: no such file or directory, stat '/home/user/ws/project/sqls/.github/postgres-migrations/'
[11:00:57 AM] [MigrationProjectService] [Information]: No postgres-migrations folder found in sqls: Error: ENOENT: no such file or directory, stat '/home/user/ws/project/sqls/.github/postgres-migrations/'
[11:00:57 AM] MCP server registered with VS Code at http://127.0.0.1:35231/mcp
[11:00:57 AM] MCP tool handlers registered
[11:00:57 AM] MCP service initialized successfully
[11:01:01 AM] [PgToolsService Initialization] [Verbose]: readAllConnections: 4 connections; excluded recent)
[11:01:03 AM] Connecting to server "postgres07.dev.example.com" on document "untitled:Untitled-1".
[11:01:03 AM] Connected to server "postgres07.dev.example.com" on document "untitled:Untitled-1". Server information: {"isCloud":false,"server":"PostgreSQL","serverVersion":"15.0.14"}
[11:01:03 AM] Connecting to server "postgres07.dev.example.com" on document "objectexplorer://E893AA0E-219D-4455-ADFE-660BC91298E2/".
[11:01:03 AM] Connected to server "postgres07.dev.example.com" on document "objectexplorer://E893AA0E-219D-4455-ADFE-660BC91298E2/". Server information: {"isCloud":false,"server":"PostgreSQL","serverVersion":"15.0.14"}
[11:01:08 AM] [ObjectExplorerService] [All]: Getting root OE nodes
[11:01:08 AM] [PgToolsService Initialization] [Verbose]: readAllConnections: 4 connections; excluded recent)
[11:01:08 AM] [ObjectExplorerService] [All]: Getting children for node 'objectexplorer://E893AA0E-219D-4455-ADFE-660BC91298E2/'

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-verifyHas been releated or pre-released, awaiting verification of fix.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions