Skip to content

docs(pg-pool): use connectionString for a database URL in README - #3861

Open
ragib-mrb wants to merge 1 commit into
brianc:masterfrom
ragib-mrb:docs/pg-pool-connection-string
Open

ragib-mrb wants to merge 1 commit into
brianc:masterfrom
ragib-mrb:docs/pg-pool-connection-string

Conversation

@ragib-mrb

Copy link
Copy Markdown

The pg-pool README said you have to parse a database URL into a config object yourself, and the example used the deprecated url.parse() (prints DEP0169 on recent Node). The pool already passes its options to each client, and the client parses connectionString (see pg/lib/connection-parameters.js and pg-pool/test/connection-strings.js). This replaces the manual parsing example with the connectionString option.

##### Note:

The Pool constructor does not support passing a Database URL as the parameter. To use pg-pool on heroku, for example, you need to parse the URL into a config object. Here is an example of how to parse a Database URL.
The Pool constructor does not support passing a Database URL as the parameter. To connect with a Database URL, for example on heroku, pass it as the `connectionString` option instead. It is passed to each client, which parses it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Pool constructor does not support passing a Database URL as the parameter. To connect with a Database URL, for example on heroku, pass it as the `connectionString` option instead. It is passed to each client, which parses it.
To connect with a [connection URI](https://node-postgres.com/features/connecting#connection-uri), pass it as the `connectionString` client option.

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.

2 participants