porsager / porsager/postgres

Setting max: undefined results in only 1 connection being created

Open
#833 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8.7k
Forks
374
Avg merge
11d 16h
Merged PRs (30d)
1

Description

In our code we had an issue where we passed max: undefined when creating a Postgres instance, expecting that it would fall back to the default 10.

However, the undefined value seems to overwrite the default max: 10 due to this line:
https://github.com/porsager/postgres/blob/master/src/index.js#L472

Then, due to this line, the array resolves to [undefined] and therefore only a single connection will be created.
https://github.com/porsager/postgres/blob/master/src/index.js#L65

If max: undefined is passed then perhaps the default 10 needs to take precedence.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/index.js around lines 472 and 65 to trace how an explicitly passed undefined max replaces the default and becomes the connection-count array. Confirm that leaving max undefined preserves the default of 10 and allows ten connections to be created.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, postgresql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.