68 Commits

Author SHA1 Message Date
Brian M. Carlson
cb928ded2a Prettier pg-query-stream 2020-04-10 10:34:34 -05:00
Brian M. Carlson
3002d5cbdd Auto-fix pg-cursor 2020-04-10 10:29:54 -05:00
Brian M. Carlson
a8471aa54b Set up prettier in workspace dir 2020-04-10 10:29:13 -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
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
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
a227d3e8d4 Publish
- 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
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
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
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
Brian M. Carlson
b3f0728a11 Publish
- 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
d9fcda8cf7 Publish
- 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 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
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
2020-01-10 09:22:00 -06: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
2019-12-29 17:50:24 +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
2019-12-28 17:16:42 +00: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
Andrew Heuermann
6363778675
Fixing test 2019-12-27 16:04:45 -06:00
Andrew Heuermann
bb8e806bc5
Adding ability to pass through idle_in_transaction_session_timeout 2019-12-27 15:31:19 -06:00
Brian M. Carlson
637bcf355c Cleanup things a bit 2019-12-27 17:52:28 +00:00
Brian M. Carlson
4c27ad294f Add 'packages/pg-pool/' from commit 'cb96ae2d6e37b1414df405d80258e0e2bafeaba0'
git-subtree-dir: packages/pg-pool
git-subtree-mainline: 69345eb96aa2552b288247960aa7126d41210eb6
git-subtree-split: cb96ae2d6e37b1414df405d80258e0e2bafeaba0
2019-12-27 04:01:42 +00:00
Brian M. Carlson
69345eb96a Publish
- pg-cursor@2.1.0
 - pg-packet-stream@1.1.0
 - pg-query-stream@2.1.0
 - pg@7.16.0
2019-12-27 03:56:07 +00:00
Brian M. Carlson
01e0644b99 Add pretest and prepublish script 2019-12-27 03:39:56 +00:00
Brian C
3278dced6e
Merge pull request #2044 from brianc/bmc/packet-stream-parser
Add packet stream parser
2019-12-26 21:36:26 -06:00
Brian M. Carlson
6168f2ee0d Disable lint on missing module since the file is not included 2019-12-27 03:22:30 +00:00
Brian M. Carlson
68e063e30c Merge origin/master 2019-12-27 02:59:42 +00:00
Brian M. Carlson
766e48f34a Update types & move some configs around 2019-12-27 02:55:18 +00:00
Brian M. Carlson
5a6166d0ae Fire close callback when ready for next query
Working on fixing some timing issues in pg-query-stream it uncovered an issue where the cursor is firing its 'close' callback before it's actually entirely ready to dispatch another query.  This change makes the close callback trigger when the connection re-enters `readyForQuery` state.
2019-12-26 18:36:29 +00:00
Brian M. Carlson
dfae78e383 Publish
- pg-cursor@2.0.3
 - pg-query-stream@2.0.2
 - pg@7.15.2
2019-12-26 17:42:55 +00:00
Brian C
582b56d701
Merge pull request #2036 from brianc/bmc/update-readme
Update readme
2019-12-23 10:50:12 -06:00
Brian M. Carlson
c090e4fdaf Actually update the right file in the right place... 2019-12-20 17:53:26 -06:00
Brian M. Carlson
8b7e874a37 Update readme 2019-12-20 17:48:26 -06:00