2817 Commits

Author SHA1 Message Date
Herman J. Radtke III
9cc7d8eb94
docs: add missing parameters on pg.Client Config (#3422)
- client_encoding
- fallback_application_name
- options
2025-04-22 11:04:17 -05:00
Brian Carlson
9ec9e5f58d Publish
- pg-cloudflare@1.2.0
 - pg-connection-string@2.8.0
 - pg-cursor@2.14.0
 - pg-esm-test@1.1.0
 - pg-native@3.4.0
 - pg-pool@3.9.0
 - pg-protocol@1.9.0
 - pg-query-stream@4.9.0
 - pg@8.15.0
pg-cloudflare@1.2.0 pg-connection-string@2.8.0 pg-cursor@2.14.0 pg-esm-test@1.1.0 pg-native@3.4.0 pg-pool@3.9.0 pg-protocol@1.9.0 pg-query-stream@4.9.0 pg@8.15.0
2025-04-22 10:55:24 -05:00
Brian Carlson
60817cd914 Update changelog 2025-04-22 10:55:10 -05:00
Brian C
940479bc4b
Add esm exports (#3423)
* build: add esm exports

* fix: add defaults as per arethetypeswrong report

* fix: add missing types

* lint

* Fix broken tests

* Add (failing) test for esm compat

* Begin moving files to proper extension and adding tests

* Add tests for connection-string and fix cloudflare module type and esm compat

* Add query-stream and cursor as esm exports

* Update PR copilot review

* Publish

 - pg-cloudflare@1.1.2-alpha.0
 - pg-connection-string@2.7.1-alpha.0
 - pg-cursor@2.13.2-alpha.0
 - pg-esm-test@1.0.1-alpha.0
 - pg-native@3.3.1-alpha.0
 - pg-pool@3.8.1-alpha.0
 - pg-protocol@1.8.1-alpha.0
 - pg-query-stream@4.8.2-alpha.0
 - pg@8.14.2-alpha.0

* More cf compat work

* Publish

 - pg-cloudflare@1.1.2-alpha.1
 - pg-cursor@2.13.2-alpha.1
 - pg-esm-test@1.0.1-alpha.1
 - pg-pool@3.8.1-alpha.1
 - pg-query-stream@4.8.2-alpha.1
 - pg@8.14.2-alpha.1

* Add more cf compat and update tests

* Make tests pass - update exports for esm

* Use env vars for test connection in cf tests

* Fix lint

* Fit vitest into existing legacy framework

* Skip worker tests on node below 18

* Revert doc changes for now

* Remove legacy worker test in favor of vitest

---------

Co-authored-by: Luca Ban <mesqueeb@users.noreply.github.com>
2025-04-22 10:53:22 -05:00
Patrick Malouin
81ec0635fc
feat(pg-connection-string): get closer to libpq semantics for sslmode
Allows user to change the semantics of `sslmode` to be as close as possible to libpq semantics. The opt in can be enabled using `useLibpqCompat` parsing option or the non-standard `uselibpqcompat` query string parameter.

---------

Co-authored-by: Charmander <~@charmander.me>
Co-authored-by: Herman J. Radtke III <herman@hermanradtke.com>
2025-04-20 08:13:33 -04:00
Charmander
d8fb2f9c35
test: Avoid silencing errors from idle timeout test’s child process (#3419)
This hid the error fixed in #3263, for example.
2025-04-13 07:18:33 +00:00
Alex Anderson
9b510373a6
eslint: enable recommended ruleset (#3263) 2025-04-12 08:17:33 +00:00
Herman J. Radtke III
5a8b1a7d24 feat(pg-connection-string): ClientConfig helper functions
Two new functions are introduced to make it easy for TypeScript
users to use a PostgresSQL connection string with pg Client.

Fixes #2280
2025-04-08 20:06:28 -04:00
Charmander
a9fd34fb42
Revert "docs: fix bug in transaction example (#3414)"
This reverts commit dcb4257898d1d8d37110a4364922206dad33f9fe.

The change doesn’t fix the bug it claims to (`finally` always runs) and introduces a resource leak if the `ROLLBACK` query fails. The related bug that a broken client can be returned to the pool remains unaffected either way.
2025-04-03 15:10:49 -07:00
dependabot[bot]
a5d03a0774
build(deps-dev): bump eslint-plugin-prettier from 5.1.2 to 5.2.5 (#3412)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 5.1.2 to 5.2.5.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v5.1.2...v5.2.5)

---
updated-dependencies:
- dependency-name: eslint-plugin-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-01 15:38:44 -05:00
lucaesposto
dcb4257898
docs: fix bug in transaction example (#3414)
Throwing error will not allow "finally" execution, so client.release() must be invoked before it.
2025-04-01 15:38:14 -05:00
Brian Carlson
a3fefe3183 Update sponsorship info 2025-03-22 10:58:51 -05:00
Brian Carlson
477f812984 Publish
- pg-cursor@2.13.1
 - pg-query-stream@4.8.1
 - pg@8.14.1
pg-cursor@2.13.1 pg-query-stream@4.8.1 pg@8.14.1
2025-03-17 10:37:54 -05:00
Brian C
c53a472a60
Batch network packets in prepared statements (#3402)
* Batch network packets in prepared statements

Fixes #3340
Fixes #3325
Fixes #3098

* Fix type-o but mostly retrigger build for CF pages preview
2025-03-17 10:28:46 -05:00
Brian Carlson
f7c92e487c Publish
- pg-cursor@2.13.0
 - pg-native@3.3.0
 - pg-pool@3.8.0
 - pg-protocol@1.8.0
 - pg-query-stream@4.8.0
 - pg@8.14.0
pg-cursor@2.13.0 pg-native@3.3.0 pg-pool@3.8.0 pg-protocol@1.8.0 pg-query-stream@4.8.0 pg@8.14.0
2025-03-11 10:25:26 -05:00
Brian Carlson
1c45dd2828 Update changelog 2025-03-11 10:25:12 -05:00
Alex Anderson
b823a23f67
simple-query-tests: remove no-op test (#3390)
Originally skipped in daa370a61

Co-authored-by: alxndrsn <alxndrsn>
2025-03-10 13:14:01 -05:00
George MacKerron
b4022aa5c0
Add support for SCRAM-SHA-256-PLUS i.e. channel binding (#3356)
* Added support for SCRAM-SHA-256-PLUS i.e. channel binding

* Requested tweaks to channel binding

* Additional tweaks to channel binding

* Fixed lint complaints

* Update packages/pg/lib/crypto/sasl.js

Co-authored-by: Charmander <~@charmander.me>

* Update packages/pg/lib/crypto/sasl.js

Co-authored-by: Charmander <~@charmander.me>

* Update packages/pg/lib/client.js

Co-authored-by: Charmander <~@charmander.me>

* Tweaks to channel binding

* Now using homegrown certificate signature algorithm identification

* Update ssl.mdx with channel binding changes

* Allow for config object being undefined when assigning enableChannelBinding

* Fixed a test failing on an updated error message

* Removed - from hash names like SHA-256 for legacy crypto (Node 14 and below)

* Removed packageManager key from package.json

* Added some SASL/channel binding unit tests

* Added a unit test for continueSession to check expected SASL session data

* Modify tests: don't require channel binding (which cannot then work) if not using SSL

---------

Co-authored-by: Charmander <~@charmander.me>
2025-03-10 13:13:32 -05:00
francesco
1876f2000a
Add "unref" to timers (#3396)
* chore: add unref to timer

see https://nodejs.org/api/timers.html#timeoutunref

* chore: add unref to timer

see https://nodejs.org/api/timers.html#timeoutunref

* fix: lint

* fix: lint

* fix: lint

* fix: lint
2025-03-10 12:16:57 -05:00
Alex Anderson
88311c17a5
test-helper: re-add missing function spit() (#3248)
It looks like this was removed in d615ebee177ed57c7a7df861b1db675c9e0ebb0f while it still had references to it.

Reviewed-by: Charmander <~@charmander.me>
2025-02-20 01:34:23 +00:00
Nigro Simone
5a6734429c
fix(devcontainer): upgrade node to version 20 (#3385)
* fix(devcontainer): upgrade node to version 20

* chore: since Windows and Linux use different default line endings, Git may report a large number of modified files that have no differences aside from their line endings.
2025-02-13 17:22:50 -06:00
dependabot[bot]
79ee1ad15f
build(deps-dev): bump workerd from 1.20240529.0 to 1.20250129.0 (#3366)
Bumps [workerd](https://github.com/cloudflare/workerd) from 1.20240529.0 to 1.20250129.0.
- [Release notes](https://github.com/cloudflare/workerd/releases)
- [Changelog](https://github.com/cloudflare/workerd/blob/main/RELEASE.md)
- [Commits](https://github.com/cloudflare/workerd/compare/v1.20240529.0...v1.20250129.0)

---
updated-dependencies:
- dependency-name: workerd
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-13 09:46:54 -06:00
dependabot[bot]
1230c86ba9
build(deps-dev): bump lodash from 2.4.2 to 4.17.21 (#3367)
Bumps [lodash](https://github.com/lodash/lodash) from 2.4.2 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/2.4.2...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-13 09:42:45 -06:00
Charmander
582cdaf919
Assorted test fixes and cleanup (#3383)
* test: Actually test split messages in split message parsing test

* cleanup: Fix spelling in tests

* test: Wait on asynchronous tests

* cleanup: Remove unused parameter from test method `BufferList#getByteLength`

If someone did want this functionality, it would be better to use addition separate from the method anyway.

* cleanup: Remove unused test function `BufferList.concat`
2025-02-13 09:42:33 -06:00
Brian Carlson
5755b78386 Publish
- pg-cursor@2.12.3
 - pg-native@3.2.2
 - pg-query-stream@4.7.3
 - pg@8.13.3
pg-cursor@2.12.3 pg-native@3.2.2 pg-query-stream@4.7.3 pg@8.13.3
2025-02-12 18:29:56 -06:00
francesco
f6e829c564
fix: revert PR #3379 (avoid useless spread) (#3382)
* Update result.js

* Update build-result.js

* fix: lint

* fix: lint
2025-02-12 18:28:05 -06:00
Brian Carlson
732580782f Publish
- pg-cursor@2.12.2
 - pg-native@3.2.1
 - pg-pool@3.7.1
 - pg-protocol@1.7.1
 - pg-query-stream@4.7.2
 - pg@8.13.2
pg-cursor@2.12.2 pg-native@3.2.1 pg-pool@3.7.1 pg-protocol@1.7.1 pg-query-stream@4.7.2 pg@8.13.2
2025-02-11 10:19:52 -06:00
Brian Carlson
2dc9e7f2fd Update lockfile 2025-02-11 10:19:26 -06:00
francesco
5f6a6e6596
perf(pg): avoid useless spread (#3379)
* perf(pg): avoid useless spread

* fix: missing initialization
2025-02-11 10:13:15 -06:00
francesco
f1586932fd
perf(pg-native): pre-shaped result rows (#3369)
* perf(pg-native): pre-shaped result rows

Porting on pg-native https://github.com/brianc/node-postgres/issues/3042

* fix: lint

* perf(pg-native): avoid useless spread
2025-02-11 10:12:10 -06:00
francesco
0792f0904a
Update libpq to 1.8.14 and fix #3332 (#3364)
* Update libpq to 1.8.14 and fix #3332

Update libpq to 1.8.14 and fix #3332

* Add node 23
2025-02-11 10:11:25 -06:00
Andy Young
95bec690b3
fix(pg-pool): don't throw on readonly .message e.g. ErrorEvent, preserve original exception (#3374)
* fix(pg-pool): preserve original error on connection timeout, don't throw on readonly .message e.g. ErrorEvent

Fixes https://github.com/brianc/node-postgres/issues/3373

* Fix lint
2025-02-10 16:27:55 -06:00
francesco
751e7410d9
perf(utils): fast prepareValue (#3370)
* perf(utils): fast prepareValue

This PR add a performance improvements at prepare Value for non-object by skipping useless condition

* fix: lint

* fix: case of undefined

* fix: review
2025-02-10 16:26:33 -06:00
francesco
f10f569a8a
perf(utils): replace pad with String.padStart (#3371) 2025-02-07 23:59:58 +00:00
Nigro Simone
3c48f22b22
perf: pre allocate array instead of push item (#3250)
* fix: typo

* perf: pre allocate array instead of push item

* perf: refractoring missing push

* perf: avoid useless varible declaration

* perf: short control flow

* fix: lint

* more precise bench

* fix: lint
2025-01-17 15:27:35 -06:00
Arya
2de02f0a63
updated pg-native github url in package.json (#3320) 2025-01-13 13:32:45 -06:00
francesco
f12e555b73
chore: align pg-types to vanilla (#3336) 2025-01-13 13:31:25 -06:00
Davide Violante
39e5ef8370
chore: update README.md, add how to install (#3339)
Fix #3314
2025-01-13 13:30:28 -06:00
Alexandre Weinberger
9fbcf17908
read dataTypeID and tableID as unsigned uint (#3347)
* read dataTypeID and tableID as unsigned uint

this is causing issues in other projects, like https://github.com/sequelize/sequelize/issues/15466

* added tests for oids larger than 2^31
2025-01-13 13:28:25 -06:00
Islam
373093d176
docs: fix pg-pool readme grammar (#3350)
[skip ci]
2024-12-08 08:14:53 +00:00
Brian Carlson
95d7e620ef Publish
- pg-cursor@2.12.1
 - pg-query-stream@4.7.1
 - pg@8.13.1
pg-cursor@2.12.1 pg-query-stream@4.7.1 pg@8.13.1
2024-10-24 10:40:28 -05:00
Brian Carlson
072015ac0f Update changelog 2024-10-24 10:40:05 -05:00
Antariksh Mahajan
1af6321219
fix: use existing Result types for new Result (#3310)
* fix: use existing Result types for new Result

* test: add test for multiple results with custom type parser

* chore: empty commit to trigger tests
2024-10-23 17:05:33 -05:00
dependabot[bot]
8b2768f91d
Bump node-gyp from 10.1.0 to 10.2.0 (#3324)
Bumps [node-gyp](https://github.com/nodejs/node-gyp) from 10.1.0 to 10.2.0.
- [Release notes](https://github.com/nodejs/node-gyp/releases)
- [Changelog](https://github.com/nodejs/node-gyp/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nodejs/node-gyp/compare/v10.1.0...v10.2.0)

---
updated-dependencies:
- dependency-name: node-gyp
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-08 17:49:54 +00:00
Brian Carlson
92cb640fd3 Publish
- pg-connection-string@2.7.0
 - pg-cursor@2.12.0
 - pg-native@3.2.0
 - pg-pool@3.7.0
 - pg-protocol@1.7.0
 - pg-query-stream@4.7.0
 - pg@8.13.0
pg-connection-string@2.7.0 pg-cursor@2.12.0 pg-native@3.2.0 pg-pool@3.7.0 pg-protocol@1.7.0 pg-query-stream@4.7.0 pg@8.13.0
2024-09-17 10:08:42 -05:00
Brian C
f73b22f96e
Handle bad message ordering - make it catchable. Fixes 3174 (#3289)
* Handle bad message ordering - make it catchable. Fixes 3174

* Close client in test

* Mess w/ github action settings

* update ci config

* Remove redundant tests

* Update code to use handle error event

* Add tests for commandComplete message being out of order

* Lint fix

* Fix native tests

* Fix lint again...airport computer not my friend

* Not a native issue
2024-09-17 09:50:17 -05:00
Joan Miquel Torres
92bb9a24b7
Little improvement README's to dev-setup section. (#3297)
Inserted a reminder to install libpq-dev before running `yarn lerna
bootstrap`.

It's pretty straightforward in light of the error messages, but I cloned
the repo twice and failed both times.
2024-09-17 09:31:55 -05:00
dependabot[bot]
fb12280340
Bump bluebird from 3.4.1 to 3.7.2 (#3303)
Bumps [bluebird](https://github.com/petkaantonov/bluebird) from 3.4.1 to 3.7.2.
- [Release notes](https://github.com/petkaantonov/bluebird/releases)
- [Commits](https://github.com/petkaantonov/bluebird/compare/v3.4.1...v3.7.2)

---
updated-dependencies:
- dependency-name: bluebird
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-17 09:31:21 -05:00
dependabot[bot]
54eb0fa216
Bump mocha and @types/mocha (#3273)
Bumps [mocha](https://github.com/mochajs/mocha) and [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha). These dependencies needed to be updated together.

Updates `mocha` from 3.4.2 to 10.5.2
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v3.4.2...v10.5.2)

Updates `@types/mocha` from 5.2.7 to 10.0.7
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
- dependency-name: "@types/mocha"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-25 12:20:59 -05:00
Nigro Simone
b5281f5b0a
fix devcontainer (#3251)
* fix devcontainer

* fix scam autentication required

* fix connection

* install pg native lib

* fix: host

* Update devcontainer.json

* Update docker-compose.yml

* Update index.js
2024-06-24 15:16:15 -05:00