2393 Commits

Author SHA1 Message Date
Brian M. Carlson
a8471aa54b Set up prettier in workspace dir 2020-04-10 10:29:13 -05:00
Brian M. Carlson
41c899c5a2 Update changelog 2020-04-09 15:19:53 -05:00
Brian M. Carlson
da03b3f905 Publish
- pg-cursor@2.1.9
 - pg-pool@3.1.0
 - pg-protocol@1.2.1
 - pg-query-stream@3.0.6
 - pg@8.0.2
pg-cursor@2.1.9 pg-pool@3.1.0 pg-protocol@1.2.1 pg-query-stream@3.0.6 pg@8.0.2
2020-04-09 15:17:54 -05:00
Brian C
0399fe5f83
Merge pull request #2157 from chriskchew/ckc/maxuses2
Add maxUses config option to Pool
2020-04-09 14:59:48 -05:00
Brian C
ae5dae4fa4
Make several small speed tweaks for binary reading & writing (#2158) 2020-04-09 14:58:48 -05:00
Chris Chew
de81f71417 Added maxUses config option to Pool; Dev setup instructions in main README 2020-04-09 14:08:11 -05:00
Brian M. Carlson
0a90e018cd Publish
- pg-cursor@2.1.8
 - pg-protocol@1.2.0
 - pg-query-stream@3.0.5
 - pg@8.0.1
pg-cursor@2.1.8 pg-protocol@1.2.0 pg-query-stream@3.0.5 pg@8.0.1
2020-04-09 13:22:14 -05:00
Brian C
3ff91eaa32
Decouple serializing messages w/ writing them to socket (#2155)
* Move message writing to typescript lib

* Write more tests, cleanup code to some extent

* Rename package to something more representing its name

* Remove unused code

* Small tweaks based on microbenchmarks

* Rename w/o underscore
2020-04-09 12:28:19 -05:00
Brian C
2013d77b28
Parser speed improvements (#2151)
* Change from transform stream

* Yeah a thing

* Make tests pass, add new code to travis

* Update 'best' benchmarks and include tsc in pretest script

* Need to add build early so we can create test tables

* logging
2020-04-02 16:48:22 -05:00
Brian M. Carlson
90c6d1390e Update changelog
closes #2150
2020-04-01 09:15:54 -05:00
Brian M. Carlson
a227d3e8d4 Publish
- pg-cursor@2.1.7
 - pg-pool@3.0.0
 - pg-query-stream@3.0.4
 - pg@8.0.0
pg-cursor@2.1.7 pg-pool@3.0.0 pg-query-stream@3.0.4 pg@8.0.0
2020-03-30 10:45:12 -05:00
Brian C
aafd8ac64e
8.0 Release (#2117)
* Drop support for EOL versions of node (#2062)

* Drop support for EOL versions of node

* Re-add testing for node@8.x

* Revert changes to .travis.yml

* Update packages/pg-pool/package.json

Co-Authored-By: Charmander <~@charmander.me>

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

* Remove password from stringified outputs (#2066)

* Remove password from stringified outputs

Theres a security concern where if you're not careful and you include your client or pool instance in console.log or stack traces it might include the database password.  To widen the pit of success I'm making that field non-enumerable.  You can still get at it...it just wont show up "by accident" when you're logging things now.

The backwards compatiblity impact of this is very small, but it is still technically somewhat an API change so...8.0.

* Implement feedback

* Fix more whitespace the autoformatter changed

* Simplify code a bit

* Remove password from stringified outputs (#2070)

* Keep ConnectionParameters’s password property writable

`Client` writes to it when `password` is a function.

* Avoid creating password property on pool options

when it didn’t exist previously.

* Allow password option to be non-enumerable

to avoid breaking uses like `new Pool(existingPool.options)`.

* Make password property definitions consistent

in formatting and configurability.

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

* Make `native` non-enumerable (#2065)

* Make `native` non-enumerable

Making it non-enumerable means less spurious "Cannot find module"
errors in your logs when iterating over `pg` objects.

`Object.defineProperty` has been available since Node 0.12.

See https://github.com/brianc/node-postgres/issues/1894#issuecomment-543300178

* Add test for `native` enumeration

Co-authored-by: Gabe Gorelick <gabegorelick@gmail.com>

* Use class-extends to wrap Pool (#1541)

* Use class-extends to wrap Pool

* Minimize diff

* Test `BoundPool` inheritance

Co-authored-by: Charmander <~@charmander.me>
Co-authored-by: Brian C <brian.m.carlson@gmail.com>

* Continue support for creating a pg.Pool from another instance’s options (#2076)

* Add failing test for creating a `BoundPool` from another instance’s settings

* Continue support for creating a pg.Pool from another instance’s options

by dropping the requirement for the `password` property to be enumerable.

* Use user name as default database when user is non-default (#1679)

Not entirely backwards-compatible.

* Make native client password property consistent with others

i.e. configurable.

* Make notice messages not an instance of Error (#2090)

* Make notice messages not an instance of Error

Slight API cleanup to make a notice instance the same shape as it was, but not be an instance of error.  This is a backwards incompatible change though I expect the impact to be minimal.

Closes #1982

* skip notice test in travis

* Pin node@13.6 for regression in async iterators

* Check and see if node 13.8 is still borked on async iterator

* Yeah, node still has changed edge case behavior on stream

* Emit notice messages on travis

* Revert "Revert "Support additional tls.connect() options (#1996)" (#2010)" (#2113)

This reverts commit 510a273ce45fb73d0355cf384e97ea695c8a5bcc.

* Fix ssl tests (#2116)

* Convert Query to an ES6 class (#2126)

The last missing `new` deprecation warning for pg 8.

Co-authored-by: Charmander <~@charmander.me>
Co-authored-by: Gabe Gorelick <gabegorelick@gmail.com>
Co-authored-by: Natalie Wolfe <natalie@lifewanted.com>
2020-03-30 10:31:35 -05:00
dependabot[bot]
c036779d9c
Bump acorn from 7.1.0 to 7.1.1 (#2136)
Bumps [acorn](https://github.com/acornjs/acorn) from 7.1.0 to 7.1.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/7.1.0...7.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-03-30 10:31:04 -05:00
Herman J. Radtke III
5233b3e77e Release v2.2.0 2020-03-19 21:57:19 -07:00
Sam :D
11d7c591fa
typo fix (#2118) 2020-02-26 10:49:41 -06:00
Brian C
1c8b6b93cf
Call callback when end called on unconnected client (#2109)
* Call callback when end called on unconnected client

Closes #2108

* Revert a bit of the change

* Use readyState because pending doesn't exist in node 8.x

* Update packages/pg/lib/client.js

use bring your own promise

Co-Authored-By: Charmander <~@charmander.me>

Co-authored-by: Charmander <~@charmander.me>
2020-02-25 08:48:58 -06:00
Brian M. Carlson
29877530c6 Publish
- pg-cursor@2.1.6
 - pg-query-stream@3.0.3
 - pg@7.18.2
pg-cursor@2.1.6 pg-query-stream@3.0.3 pg@7.18.2
2020-02-20 10:33:37 -06:00
Brian M. Carlson
069c2e4ba7 Update sponsors 2020-02-20 10:32:38 -06:00
Kyle Lilly
c2f4b284b1
Implement handleEmptyQuery for pg-query-stream. (#2106) 2020-02-19 12:12:46 -06:00
Herman J. Radtke III
4356679356
Merge pull request #36 from djmitche/format-docs
Include documentation on the URL format in the README
2020-02-17 09:34:43 -08:00
Dustin J. Mitchell
b4e0ba329a Include documentation on the URL format in the README
This summarizes the common forms, but omits some of the more particular,
and unnecessary forms, such as specifying UNIX domain sockets with
`pg://` URLs.
2020-02-16 12:30:46 -05:00
Michal Brašna
823153138f
Destroy socket when there was an error on it (#1975)
When error happens on socket, potentially dead socket is kept open indefinitely by calling "connection.end()".
Similar issue is that it keeps socket open until long-running query is finished even though the connection was ended.
2020-02-14 08:23:41 -08:00
Karl Becker
e404dd517e
Little typo fix, and add GitHub Sponsors (#2104)
Since I believe GitHub Sponsors is your preferred way to donate now, maybe you want to totally get rid of the mention of Patreon, or mention that GitHub Sponsors is preferred?
2020-02-13 11:13:46 -08:00
Herman J. Radtke III
9b89828fac
Merge pull request #34 from danielrozenberg/support-other-socket-modes
Support more modes to set the host as a socket
2020-02-01 08:33:42 -08:00
Brian M. Carlson
b3f0728a11 Publish
- pg-cursor@2.1.5
 - pg-query-stream@3.0.2
 - pg@7.18.1
pg-cursor@2.1.5 pg-query-stream@3.0.2 pg@7.18.1
2020-01-29 18:20:42 -06:00
Brian C
5be3d95f62
Remove double-send of ssl request packet (#2086)
* Remove double-send of ssl request packet

I missed the fact that we are already sending this.  Since I don't have good test coverage for ssl [which I am planning on fixing next](https://github.com/brianc/node-postgres/issues/2009) this got missed.

I'm forcing an SSL test on travis.  This will break for me locally as I don't have SSL enabled on my local test DB. Something I will also remedy.
2020-01-29 18:10:23 -06:00
Brian M. Carlson
c0df3b3e95 Update changelog 2020-01-29 10:53:59 -06:00
Brian M. Carlson
d9fcda8cf7 Publish
- pg-cursor@2.1.4
 - pg-pool@2.0.10
 - pg-query-stream@3.0.1
 - pg@7.18.0
pg-cursor@2.1.4 pg-pool@2.0.10 pg-query-stream@3.0.1 pg@7.18.0
2020-01-29 10:48:38 -06:00
Brian M. Carlson
717ffd0e70 Update ignores 2020-01-29 10:46:03 -06:00
Brian C
11ab1daadd
Close connection on SSL connection errors (#2082)
* Close connection on SSL connection errors

Fixes #2079

* Fix test

* Remove console.log

* Fix tests, implement same behavior for native client

* Fix tests
2020-01-29 10:18:20 -06:00
Daniel Rozenberg
7ec9b70180 Use regex instead of startsWith which is unsupported in node 0.10 2020-01-28 19:40:51 -05:00
Daniel Rozenberg
b309db074f Support URL-encoded socket names 2020-01-28 19:29:38 -05:00
Daniel Rozenberg
0ff40e733b host= query param takes precedence 2020-01-28 19:28:45 -05:00
Brian C
727f1a0ee3
Do not return broken clients to the pool (#2083)
* Prevent requeuing a broken client

If a client is not queryable, the pool should prevent requeuing instead
of strictly enforcing errors to be propagated back to it.

* Write tests for change

* Use node 13.6 in travis

Some weird behavior changed w/ async iteration in node 13.7...I'm not sure if this was an unintentional break or not but it definitely diverges in behavior from node 12 and earlier versions in node 13...so for now going to run tests on 13.6 to unblock the tests from running while I track this down.

* Update packages/pg-pool/test/releasing-clients.js

Co-Authored-By: Charmander <~@charmander.me>

* Update .travis.yml

Co-authored-by: Johannes Würbach <johannes.wuerbach@googlemail.com>
Co-authored-by: Charmander <~@charmander.me>
2020-01-28 10:53:29 -06:00
Charmander
3f6760c62e Update copyright years
because someone will make a PR otherwise. No, this isn’t actually necessary.
2020-01-15 15:44:08 -08:00
Charmander
ee8d32f97c Deprecate implicit TLS rejectUnauthorized: false (#2075)
Yes, it treats `undefined` as `false`. Discussion in #2009. Introduced unintentionally in pg 0.8.7.
2020-01-15 14:59:26 -06:00
Daniel Hritzkiv
d456f1cda0 Update package.json (#2074)
Change the homepage URL's scheme to https
2020-01-14 08:00:55 -08:00
Charmander
ae3f13fad6 Fix tests skipped because of missing suffixes (#2071)
* Fix tests skipped because of missing suffixes

Mocha will happen eventually!

* Skip password tests when they can’t work

Will be made more visible when tests are ported to Mocha.

* Add testing with a user with a password to CI

Should reveal a bug in the password enumerability work, I think.

* Explain new CI matrix entry for password authentication

[ci skip]
2020-01-13 13:00:01 -06:00
Brian M. Carlson
5cf8f5f8d7 Publish
- pg-cursor@2.1.3
 - pg-query-stream@3.0.0
 - pg@7.17.1
pg-cursor@2.1.3 pg-query-stream@3.0.0 pg@7.17.1
2020-01-10 09:22:00 -06:00
Charmander
a046a5a4a5 Fix typo in changelog 2020-01-09 22:40:22 -08:00
Brian C
0895460046
pg-query-stream@3.0 release (#2059)
* Fix one unintentional possible breaking change & update readme

* Update changelog more

* Update CHANGELOG.md

Co-Authored-By: Charmander <~@charmander.me>

Co-authored-by: Charmander <~@charmander.me>
2020-01-09 23:33:40 -06:00
Brian C
19308f9ceb
Result.fields should always be an array (#2060)
This fixes a subtle backwards incompatible change.  Added a test to prevent further regressions.  Closes #2056
2020-01-09 21:30:53 -06:00
Brian C
8eca181d20
Fix pg-query-stream implementation (#2051)
* Fix pg-query-stream

There were some subtle behaviors with the stream being implemented incorrectly & not working as expected with async iteration.  I've modified the code based on #2050 and comments in #2035 to have better test coverage of async iterables and update the internals significantly to more closely match the readable stream interface.

Note: this is a __breaking__ (semver major) change to this package as the close event behavior is changed slightly, and `highWaterMark` is no longer supported.  It shouldn't impact most usage, but breaking regardless.

* Remove a bunch of additional code

* Add test for destroy + error propagation

* Add failing test for destroying unsubmitted stream

* Do not throw an uncatchable error when closing an unused cursor
2019-12-29 23:08:09 -06:00
Brian M. Carlson
6d93951783 Publish
- pg-cursor@2.1.2
 - pg-query-stream@2.1.2
 - pg@7.17.0
pg-cursor@2.1.2 pg-query-stream@2.1.2 pg@7.17.0
2019-12-29 17:50:24 +00:00
Brian M. Carlson
c8b9488d7c Update changelog 2019-12-29 17:45:50 +00:00
Brian C
6b39253a54
Merge pull request #2049 from aheuermann/idle_in_transaction_session_timeout
Adding ability to pass through idle_in_transaction_session_tim…
2019-12-29 11:38:30 -06:00
Brian M. Carlson
af4d05445d Publish
- pg-cursor@2.1.1
 - pg-pool@2.0.9
 - pg-query-stream@2.1.1
 - pg@7.16.1
pg-cursor@2.1.1 pg-pool@2.0.9 pg-query-stream@2.1.1 pg@7.16.1
2019-12-28 17:16:42 +00:00
Brian C
0b87d494ad
Merge pull request #2048 from brianc/bmc/add-pg-pool
Add pg-pool to monorepo
2019-12-28 10:28:26 -06:00
Andrew Heuermann
6ddbe6ab60
Close connection after version check 2019-12-28 09:24:45 -06:00
Andrew Heuermann
839043206d
Only run tests on >= v10 2019-12-28 09:02:04 -06:00