Skip to content

Connection String with multiple hosts is not being parsed as expected #2308

Open
@chandelabhishek

Description

@chandelabhishek

Hi There,

According to PG docs multiple hosts can be supplied in connection string.

for example:
If I supply connectionString as postgres://user:@localhost:6432,localhost:5432/db_name
it is being parsed as this:

{
    driver: 'postgres',
    user: 'user',
    password: '',
    database: ':6432,localhost/db_name',
    host: 'localhost',
    port: '5432'
}

above is throwing error. as the connection which gets constructed from this is wrong. This is the issue with pg-connection-string.

Also, I am curious, why do we need to parse a connection-string, why can't we directly pass it to libpq?

Will you accept a PR for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions