Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: brianc/node-postgres
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: pg@8.0.2
Choose a base ref
...
head repository: brianc/node-postgres
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: pg@8.0.3
Choose a head ref
  • 18 commits
  • 158 files changed
  • 3 contributors

Commits on Apr 9, 2020

  1. Update changelog

    brianc committed Apr 9, 2020
    Copy the full SHA
    41c899c View commit details

Commits on Apr 10, 2020

  1. Copy the full SHA
    a8471aa View commit details
  2. Auto-fix pg-cursor

    brianc committed Apr 10, 2020
    Copy the full SHA
    3002d5c View commit details
  3. Prettier pg-query-stream

    brianc committed Apr 10, 2020
    Copy the full SHA
    cb928de View commit details
  4. lint pg-protcol

    brianc committed Apr 10, 2020
    Copy the full SHA
    6adbcab View commit details
  5. Lint pg & turn off semicolons

    brianc committed Apr 10, 2020
    Copy the full SHA
    c13cf81 View commit details
  6. Copy the full SHA
    6353aff View commit details
  7. Re-upgrade to prettier@2.x

    brianc committed Apr 10, 2020
    Copy the full SHA
    8591d94 View commit details
  8. Actually run lint in ci

    brianc committed Apr 10, 2020
    Copy the full SHA
    12049b7 View commit details
  9. Copy the full SHA
    3d9678e View commit details
  10. Merge pull request #2161 from brianc/bmc/lint

    Prettier the codebase
    brianc authored Apr 10, 2020
    Copy the full SHA
    2ef5550 View commit details

Commits on Apr 15, 2020

  1. Refactor pg-pool to avoid potential memory leak

    Reduce the closure scope captured by the "release once" lambda function
    in _acquireClient so that it does not retain the pendingItem promise.
    Johan Levin committed Apr 15, 2020
    Copy the full SHA
    7de8b49 View commit details

Commits on Apr 21, 2020

  1. Merge pull request #2164 from johan13/mem-leak

    Refactor pg-pool to avoid potential memory leak
    brianc authored Apr 21, 2020
    Copy the full SHA
    0729130 View commit details

Commits on Apr 22, 2020

  1. Replace uses of private/undocumented readyState API

    The `readyState` of a newly-created `net.Socket` changed from `'closed'` to `'open'` in Node 14.0.0, so this makes the JS driver work on Node 14.
    
    `Connection` now always calls `connect` on its `stream` when `connect` is called on it.
    charmander committed Apr 22, 2020
    Copy the full SHA
    149f482 View commit details
  2. Add Node 14 to CI

    charmander committed Apr 22, 2020
    Copy the full SHA
    c8fb416 View commit details
  3. Merge pull request #2171 from charmander/no-readystate

    Replace uses of private/undocumented `readyState` API
    brianc authored Apr 22, 2020
    Copy the full SHA
    932c89d View commit details
  4. lockfile

    brianc committed Apr 22, 2020
    Copy the full SHA
    a86cb90 View commit details
  5. Publish

     - pg-cursor@2.1.10
     - pg-pool@3.1.1
     - pg-protocol@1.2.2
     - pg-query-stream@3.0.7
     - pg@8.0.3
    brianc committed Apr 22, 2020
    Copy the full SHA
    3532880 View commit details
Showing with 4,067 additions and 3,478 deletions.
  1. +6 −17 .eslintrc
  2. +1 −0 .travis.yml
  3. +4 −0 CHANGELOG.md
  4. +18 −3 package.json
  5. +4 −4 packages/pg-cursor/index.js
  6. +3 −14 packages/pg-cursor/package.json
  7. +15 −15 packages/pg-cursor/test/error-handling.js
  8. +37 −37 packages/pg-cursor/test/index.js
  9. +7 −7 packages/pg-cursor/test/no-data-handling.js
  10. +8 −8 packages/pg-cursor/test/pool.js
  11. +3 −3 packages/pg-cursor/test/query-config.js
  12. +2 −2 packages/pg-cursor/test/transactions.js
  13. +42 −42 packages/pg-pool/index.js
  14. +1 −1 packages/pg-pool/package.json
  15. +26 −20 packages/pg-pool/test/bring-your-own-promise.js
  16. +2 −3 packages/pg-pool/test/connection-strings.js
  17. +20 −15 packages/pg-pool/test/connection-timeout.js
  18. +19 −13 packages/pg-pool/test/ending.js
  19. +109 −93 packages/pg-pool/test/error-handling.js
  20. +4 −4 packages/pg-pool/test/events.js
  21. +59 −51 packages/pg-pool/test/idle-timeout.js
  22. +8 −11 packages/pg-pool/test/index.js
  23. +73 −60 packages/pg-pool/test/max-uses.js
  24. +2 −2 packages/pg-pool/test/setup.js
  25. +43 −35 packages/pg-pool/test/sizing.js
  26. +1 −1 packages/pg-pool/test/verify.js
  27. +1 −1 packages/pg-protocol/package.json
  28. +3 −3 packages/pg-protocol/src/b.ts
  29. +25 −26 packages/pg-protocol/src/buffer-reader.ts
  30. +40 −42 packages/pg-protocol/src/buffer-writer.ts
  31. +137 −124 packages/pg-protocol/src/inbound-parser.test.ts
  32. +3 −3 packages/pg-protocol/src/index.ts
  33. +98 −86 packages/pg-protocol/src/messages.ts
  34. +35 −48 packages/pg-protocol/src/outbound-serializer.test.ts
  35. +116 −90 packages/pg-protocol/src/parser.ts
  36. +28 −36 packages/pg-protocol/src/serializer.ts
  37. +6 −10 packages/pg-protocol/src/testing/buffer-list.ts
  38. +19 −46 packages/pg-protocol/src/testing/test-buffers.ts
  39. +1 −1 packages/pg-query-stream/index.js
  40. +4 −5 packages/pg-query-stream/package.json
  41. +72 −69 packages/pg-query-stream/test/close.js
  42. +14 −8 packages/pg-query-stream/test/concat.js
  43. +2 −2 packages/pg-query-stream/test/config.js
  44. +10 −8 packages/pg-query-stream/test/empty-query.js
  45. +9 −7 packages/pg-query-stream/test/error.js
  46. +6 −4 packages/pg-query-stream/test/instant.js
  47. +6 −6 packages/pg-query-stream/test/passing-options.js
  48. +10 −5 packages/pg-query-stream/test/pauses.js
  49. +9 −4 packages/pg-query-stream/test/slow-reader.js
  50. +5 −6 packages/pg-query-stream/test/stream-tester-timestamp.js
  51. +1 −4 packages/pg-query-stream/test/stream-tester.js
  52. +2 −6 packages/pg/Makefile
  53. +36 −36 packages/pg/bench.js
  54. +42 −31 packages/pg/lib/client.js
  55. +12 −11 packages/pg/lib/connection-fast.js
  56. +3 −5 packages/pg/lib/connection-parameters.js
  57. +32 −51 packages/pg/lib/connection.js
  58. +1 −1 packages/pg/lib/defaults.js
  59. +3 −3 packages/pg/lib/index.js
  60. +8 −8 packages/pg/lib/native/client.js
  61. +27 −22 packages/pg/lib/native/query.js
  62. +44 −24 packages/pg/lib/query.js
  63. +34 −30 packages/pg/lib/sasl.js
  64. +7 −4 packages/pg/lib/type-overrides.js
  65. +43 −27 packages/pg/lib/utils.js
  66. +4 −11 packages/pg/package.json
  67. +34 −35 packages/pg/script/create-test-tables.js
  68. +6 −11 packages/pg/script/dump-db-types.js
  69. +7 −4 packages/pg/script/list-db-types.js
  70. +5 −7 packages/pg/test/buffer-list.js
  71. +56 −47 packages/pg/test/integration/client/api-tests.js
  72. +22 −17 packages/pg/test/integration/client/appname-tests.js
  73. +204 −150 packages/pg/test/integration/client/array-tests.js
  74. +51 −15 packages/pg/test/integration/client/big-simple-query-tests.js
  75. +3 −3 packages/pg/test/integration/client/configuration-tests.js
  76. +16 −14 packages/pg/test/integration/client/connection-timeout-tests.js
  77. +17 −13 packages/pg/test/integration/client/custom-types-tests.js
  78. +1 −1 packages/pg/test/integration/client/empty-query-tests.js
  79. +70 −53 packages/pg/test/integration/client/error-handling-tests.js
  80. +22 −17 packages/pg/test/integration/client/huge-numeric-tests.js
  81. +42 −26 packages/pg/test/integration/client/idle_in_transaction_session_timeout-tests.js
  82. +32 −23 packages/pg/test/integration/client/json-type-parsing-tests.js
  83. +46 −37 packages/pg/test/integration/client/multiple-results-tests.js
  84. +28 −24 packages/pg/test/integration/client/network-partition-tests.js
  85. +25 −19 packages/pg/test/integration/client/no-data-tests.js
  86. +7 −5 packages/pg/test/integration/client/no-row-result-tests.js
  87. +33 −24 packages/pg/test/integration/client/notice-tests.js
  88. +27 −19 packages/pg/test/integration/client/parse-int-8-tests.js
  89. +72 −47 packages/pg/test/integration/client/prepared-statement-tests.js
  90. +21 −27 packages/pg/test/integration/client/promise-api-tests.js
  91. +10 −11 packages/pg/test/integration/client/query-as-promise-tests.js
  92. +13 −8 packages/pg/test/integration/client/query-column-names-tests.js
  93. +89 −62 packages/pg/test/integration/client/query-error-handling-prepared-statement-tests.js
  94. +106 −79 packages/pg/test/integration/client/query-error-handling-tests.js
  95. +37 −22 packages/pg/test/integration/client/result-metadata-tests.js
  96. +17 −12 packages/pg/test/integration/client/results-as-array-tests.js
  97. +24 −12 packages/pg/test/integration/client/row-description-on-results-tests.js
  98. +11 −5 packages/pg/test/integration/client/simple-query-tests.js
  99. +13 −7 packages/pg/test/integration/client/ssl-tests.js
  100. +29 −22 packages/pg/test/integration/client/statement_timeout-tests.js
  101. +81 −58 packages/pg/test/integration/client/transaction-tests.js
  102. +174 −124 packages/pg/test/integration/client/type-coercion-tests.js
  103. +33 −26 packages/pg/test/integration/client/type-parser-override-tests.js
  104. +107 −71 packages/pg/test/integration/connection-pool/error-tests.js
  105. +7 −5 packages/pg/test/integration/connection-pool/idle-timeout-tests.js
  106. +11 −9 packages/pg/test/integration/connection-pool/native-instance-tests.js
  107. +17 −14 packages/pg/test/integration/connection-pool/yield-support-tests.js
  108. +2 −2 packages/pg/test/integration/connection/bound-command-tests.js
  109. +11 −13 packages/pg/test/integration/connection/copy-tests.js
  110. +91 −90 packages/pg/test/integration/connection/dynamic-password-tests.js
  111. +4 −4 packages/pg/test/integration/connection/test-helper.js
  112. +28 −19 packages/pg/test/integration/domain-tests.js
  113. +6 −3 packages/pg/test/integration/gh-issues/130-tests.js
  114. +24 −13 packages/pg/test/integration/gh-issues/131-tests.js
  115. +1 −1 packages/pg/test/integration/gh-issues/1382-tests.js
  116. +4 −7 packages/pg/test/integration/gh-issues/1542-tests.js
  117. +7 −7 packages/pg/test/integration/gh-issues/1854-tests.js
  118. +2 −1 packages/pg/test/integration/gh-issues/199-tests.js
  119. +1 −2 packages/pg/test/integration/gh-issues/1992-tests.js
  120. +3 −5 packages/pg/test/integration/gh-issues/2056-tests.js
  121. +9 −10 packages/pg/test/integration/gh-issues/2064-tests.js
  122. +2 −5 packages/pg/test/integration/gh-issues/2079-tests.js
  123. +8 −8 packages/pg/test/integration/gh-issues/2085-tests.js
  124. +1 −1 packages/pg/test/integration/gh-issues/2108-tests.js
  125. +11 −9 packages/pg/test/integration/gh-issues/507-tests.js
  126. +48 −38 packages/pg/test/integration/gh-issues/600-tests.js
  127. +16 −16 packages/pg/test/integration/gh-issues/699-tests.js
  128. +3 −2 packages/pg/test/integration/gh-issues/787-tests.js
  129. +1 −1 packages/pg/test/integration/gh-issues/882-tests.js
  130. +10 −11 packages/pg/test/integration/gh-issues/981-tests.js
  131. +8 −5 packages/pg/test/integration/test-helper.js
  132. +16 −9 packages/pg/test/native/callback-api-tests.js
  133. +10 −6 packages/pg/test/native/evented-api-tests.js
  134. +10 −12 packages/pg/test/suite.js
  135. +13 −40 packages/pg/test/test-buffers.js
  136. +19 −12 packages/pg/test/test-helper.js
  137. +3 −3 packages/pg/test/unit/client/configuration-tests.js
  138. +5 −3 packages/pg/test/unit/client/early-disconnect-tests.js
  139. +25 −33 packages/pg/test/unit/client/escape-tests.js
  140. +2 −3 packages/pg/test/unit/client/md5-password-tests.js
  141. +15 −13 packages/pg/test/unit/client/prepared-statement-tests.js
  142. +3 −4 packages/pg/test/unit/client/query-queue-tests.js
  143. +8 −5 packages/pg/test/unit/client/result-metadata-tests.js
  144. +100 −67 packages/pg/test/unit/client/sasl-scram-tests.js
  145. +3 −3 packages/pg/test/unit/client/set-keepalives-tests.js
  146. +18 −8 packages/pg/test/unit/client/simple-query-tests.js
  147. +14 −6 packages/pg/test/unit/client/stream-and-query-error-interaction-tests.js
  148. +8 −5 packages/pg/test/unit/client/test-helper.js
  149. +5 −5 packages/pg/test/unit/client/throw-in-type-parser-tests.js
  150. +94 −68 packages/pg/test/unit/connection-parameters/creation-tests.js
  151. +1 −1 packages/pg/test/unit/connection-parameters/environment-variable-tests.js
  152. +8 −8 packages/pg/test/unit/connection/error-tests.js
  153. +101 −86 packages/pg/test/unit/connection/inbound-parser-tests.js
  154. +38 −44 packages/pg/test/unit/connection/outbound-sending-tests.js
  155. +3 −21 packages/pg/test/unit/connection/startup-tests.js
  156. +11 −8 packages/pg/test/unit/test-helper.js
  157. +21 −9 packages/pg/test/unit/utils-tests.js
  158. +111 −163 yarn.lock
23 changes: 6 additions & 17 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"plugins": [
"node"
"prettier"
],
"parser": "@typescript-eslint/parser",
"extends": [
"standard",
"eslint:recommended",
"plugin:node/recommended"
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
],
"ignorePatterns": [
"**/*.ts"
"node_modules",
"packages/pg-protocol/dist/**/*"
],
"parserOptions": {
"ecmaVersion": 2017,
@@ -18,17 +19,5 @@
"node": true,
"es6": true,
"mocha": true
},
"rules": {
"space-before-function-paren": "off",
"node/no-unsupported-features/es-syntax": "off",
"node/no-unpublished-require": [
"error",
{
"allowModules": [
"pg"
]
}
]
}
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ node_js:
# if 13.8 still has this problem when it comes down I'll talk to the node team about the change
# in the mean time...peg to 13.6
- 13.6
- 14

addons:
postgresql: "10"
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ For richer information consult the commit log on github with referenced pull req

We do not include break-fix version release in this file.

### pg-pool@3.1.0

- Add [maxUses](https://github.com/brianc/node-postgres/pull/2157) config option.

### pg@8.0.0

#### note: for detailed release notes please [check here](https://node-postgres.com/announcements#2020-02-25)
21 changes: 18 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -10,13 +10,28 @@
"packages/*"
],
"scripts": {
"test": "yarn lerna exec yarn test",
"test": "yarn lint && yarn lerna exec yarn test",
"build": "yarn lerna exec --scope pg-protocol yarn build",
"pretest": "yarn build",
"lint": "yarn lerna exec --parallel yarn lint"
"lint": "!([[ -e node_modules/.bin/prettier ]]) || eslint '*/**/*.{js,ts,tsx}'"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.2",
"lerna": "^3.19.0"
},
"dependencies": {}
"optionalDependencies": {
"prettier": "2.0.4"
},
"prettier": {
"semi": false,
"printWidth": 120,
"arrowParens": "always",
"trailingComma": "es5",
"singleQuote": true
}
}
8 changes: 4 additions & 4 deletions packages/pg-cursor/index.js
Original file line number Diff line number Diff line change
@@ -44,23 +44,23 @@ Cursor.prototype.submit = function (connection) {

con.parse(
{
text: this.text
text: this.text,
},
true
)

con.bind(
{
portal: this._portal,
values: this.values
values: this.values,
},
true
)

con.describe(
{
type: 'P',
name: this._portal // AWS Redshift requires a portal name
name: this._portal, // AWS Redshift requires a portal name
},
true
)
@@ -165,7 +165,7 @@ Cursor.prototype._getRows = function (rows, cb) {
this._rows = []
const msg = {
portal: this._portal,
rows: rows
rows: rows,
}
this.connection.execute(msg, true)
this.connection.flush()
17 changes: 3 additions & 14 deletions packages/pg-cursor/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "pg-cursor",
"version": "2.1.9",
"version": "2.1.10",
"description": "Query cursor extension for node-postgres",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "mocha && eslint .",
"lint": "eslint ."
"test": "mocha"
},
"repository": {
"type": "git",
@@ -17,17 +16,7 @@
"author": "Brian M. Carlson",
"license": "MIT",
"devDependencies": {
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-prettier": "^3.1.1",
"mocha": "^6.2.2",
"pg": "^8.0.2",
"prettier": "^1.18.2"
},
"prettier": {
"semi": false,
"printWidth": 120,
"trailingComma": "none",
"singleQuote": true
"pg": "^8.0.3"
}
}
30 changes: 15 additions & 15 deletions packages/pg-cursor/test/error-handling.js
Original file line number Diff line number Diff line change
@@ -5,14 +5,14 @@ const pg = require('pg')

const text = 'SELECT generate_series as num FROM generate_series(0, 4)'

describe('error handling', function() {
it('can continue after error', function(done) {
describe('error handling', function () {
it('can continue after error', function (done) {
const client = new pg.Client()
client.connect()
const cursor = client.query(new Cursor('asdfdffsdf'))
cursor.read(1, function(err) {
cursor.read(1, function (err) {
assert(err)
client.query('SELECT NOW()', function(err) {
client.query('SELECT NOW()', function (err) {
assert.ifError(err)
client.end()
done()
@@ -22,16 +22,16 @@ describe('error handling', function() {
})

describe('read callback does not fire sync', () => {
it('does not fire error callback sync', done => {
it('does not fire error callback sync', (done) => {
const client = new pg.Client()
client.connect()
const cursor = client.query(new Cursor('asdfdffsdf'))
let after = false
cursor.read(1, function(err) {
cursor.read(1, function (err) {
assert(err, 'error should be returned')
assert.strictEqual(after, true, 'should not call read sync')
after = false
cursor.read(1, function(err) {
cursor.read(1, function (err) {
assert(err, 'error should be returned')
assert.strictEqual(after, true, 'should not call read sync')
client.end()
@@ -42,18 +42,18 @@ describe('read callback does not fire sync', () => {
after = true
})

it('does not fire result sync after finished', done => {
it('does not fire result sync after finished', (done) => {
const client = new pg.Client()
client.connect()
const cursor = client.query(new Cursor('SELECT NOW()'))
let after = false
cursor.read(1, function(err) {
cursor.read(1, function (err) {
assert(!err)
assert.strictEqual(after, true, 'should not call read sync')
cursor.read(1, function(err) {
cursor.read(1, function (err) {
assert(!err)
after = false
cursor.read(1, function(err) {
cursor.read(1, function (err) {
assert(!err)
assert.strictEqual(after, true, 'should not call read sync')
client.end()
@@ -66,16 +66,16 @@ describe('read callback does not fire sync', () => {
})
})

describe('proper cleanup', function() {
it('can issue multiple cursors on one client', function(done) {
describe('proper cleanup', function () {
it('can issue multiple cursors on one client', function (done) {
const client = new pg.Client()
client.connect()
const cursor1 = client.query(new Cursor(text))
cursor1.read(8, function(err, rows) {
cursor1.read(8, function (err, rows) {
assert.ifError(err)
assert.strictEqual(rows.length, 5)
const cursor2 = client.query(new Cursor(text))
cursor2.read(8, function(err, rows) {
cursor2.read(8, function (err, rows) {
assert.ifError(err)
assert.strictEqual(rows.length, 5)
client.end()
Loading