Skip to content

fix: preserve query string in config.options when parsing connection URL#3653

Closed
mujib77 wants to merge 3 commits intobrianc:masterfrom
mujib77:fix/preserve-options-in-parsed-config
Closed

fix: preserve query string in config.options when parsing connection URL#3653
mujib77 wants to merge 3 commits intobrianc:masterfrom
mujib77:fix/preserve-options-in-parsed-config

Conversation

@mujib77
Copy link
Copy Markdown

@mujib77 mujib77 commented Apr 12, 2026

Problem

When parsing a PostgreSQL connection URL with query parameters
(e.g. ?schema=public&ssl=true), the parser spreads each param
directly onto the config object but never preserves the raw query
string in config.options.

This breaks code that expects config.options to contain the
original query string — for example, when reconstructing connection
URLs or implementing SSH tunneling.

Fixes #3418

Solution

After parsing search params, save the raw query string to
config.options if it exists:

if (result.search) {
  config.options = result.search.slice(1)
}

Test

Manually verified that parsing a URL with query params now
correctly populates config.options.

@mujib77 mujib77 requested a review from hjr3 as a code owner April 12, 2026 15:01
@charmander charmander closed this Apr 12, 2026
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.

Issue: pg-connection-string parser doesn't provide options property for query parameters

2 participants