Skip to content

Curious: why aren't keyword/value connection strings supported in connection interface? #2125

Closed
@zemccartney

Description

@zemccartney

Hi there,

First off, I apologize if this isn't the right place for semi-random questions. Happy to go elsewhere if I'm off base here, not my intention at all to assume free help.

Anyway, I've been curious:

  • Why aren't keyword/value connection strings (by which I mean the format described in section 32.1.1.1 here: https://www.postgresql.org/docs/9.6/libpq-connect.html) supported in the client connection interface?
  • And why is that format reserved for connecting the native client only i.e. derived from the user's input connection config via pg package's Connection.getLibpqConnectionString?

So, just as you can input a connection URI e.g. new Client({ connectionString: 'postgresql://dbuser:secretpassword@localhost:5432/mydb' }),

would there be any value to allowing a user to configure a client with an equivalent key/val string e.g. something like new Client({ connectionString: "dbname=mydb user=dbuser password=secretpassword host=localhost port=5432" })?

I assume I'm still missing plenty here, but immediately, I can see the connection URI format feels maybe easier to write and, I assume, more familiar from other database engines e.g. mysql. Also, I know the key/val string format has rules for allowing spaces within identifiers and escaping that would further complicate writing in this format.

That said, if supporting this feature / "feature", more in the interest of theoretical completeness, would be even potentially useful, I'd be more than happy to contribute

Thanks for all the massive effort behind this tool; much appreciated!

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