Skip to content

Commit 8260cb9

Browse files
authored
Merge pull request #1 from brianc/master
update with original
2 parents 9517efd + f6c40b9 commit 8260cb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+955
-639
lines changed

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
*.swp
3+
*.log
4+
.lock-wscript
5+
build/
6+
*~
7+
test/
8+
script/

.travis.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,44 @@
11
language: node_js
2-
node_js:
3-
- "0.10"
4-
- "0.12"
5-
- "iojs"
2+
sudo: false
3+
dist: trusty
64
before_script:
75
- node script/create-test-tables.js pg://[email protected]:5432/postgres
86
env:
9-
- PGUSER=postgres PGDATABASE=postgres
7+
- CC=clang CXX=clang++ npm_config_clang=1 PGUSER=postgres PGDATABASE=postgres
8+
9+
node_js: "6"
10+
addons:
11+
postgresql: "9.6"
12+
13+
matrix:
14+
include:
15+
- node_js: "0.10"
16+
addons:
17+
postgresql: "9.6"
18+
env: []
19+
- node_js: "0.12"
20+
addons:
21+
postgresql: "9.6"
22+
env: []
23+
- node_js: "4"
24+
addons:
25+
postgresql: "9.6"
26+
- node_js: "5"
27+
addons:
28+
postgresql: "9.6"
29+
- node_js: "6"
30+
addons:
31+
postgresql: "9.1"
32+
dist: precise
33+
- node_js: "6"
34+
addons:
35+
postgresql: "9.2"
36+
- node_js: "6"
37+
addons:
38+
postgresql: "9.3"
39+
- node_js: "6"
40+
addons:
41+
postgresql: "9.4"
42+
- node_js: "6"
43+
addons:
44+
postgresql: "9.5"

NEWS.md renamed to CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,75 @@ For richer information consult the commit log on github with referenced pull req
44

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

7+
### v6.1.0
8+
9+
- Add optional callback parameter to the pure JavaScript `client.end` method. The native client already supported this.
10+
11+
### v6.0.0
12+
13+
#### Breaking Changes
14+
- Remove `pg.pools`. There is still a reference kept to the pools created & tracked by `pg.connect` but it has been renamed, is considered private, and should not be used. Accessing this API directly was uncommon and was _supposed_ to be private but was incorrectly documented on the wiki. Therefore, it is a breaking change of an (unintentionally) public interface to remove it by renaming it & making it private. Eventually `pg.connect` itself will be deprecated in favor of instantiating pools directly via `new pg.Pool()` so this property should become completely moot at some point. In the mean time...check out the new features...
15+
16+
#### New features
17+
18+
- Replace internal pooling code with [pg-pool](https://github.com/brianc/node-pg-pool). This is the first step in eventually deprecating and removing the singleton `pg.connect`. The pg-pool constructor is exported from node-postgres at `require('pg').Pool`. It provides a backwards compatible interface with `pg.connect` as well as a promise based interface & additional niceties.
19+
20+
You can now create an instance of a pool and don't have to rely on the `pg` singleton for anything:
21+
22+
```
23+
var pg = require('pg')
24+
25+
var pool = new pg.Pool()
26+
27+
// your friendly neighboorhood pool interface, without the singleton
28+
pool.connect(function(err, client, done) {
29+
// ...
30+
})
31+
```
32+
33+
Promise support & other goodness lives now in [pg-pool](https://github.com/brianc/node-pg-pool).
34+
35+
__Please__ read the readme at [pg-pool](https://github.com/brianc/node-pg-pool) for the full api.
36+
37+
- Included support for tcp keep alive. Enable it as follows:
38+
39+
```js
40+
var client = new Client({ keepAlive: true })
41+
```
42+
43+
This should help with backends incorrectly considering idle clients to be dead and prematurely disconnecting them.
44+
45+
46+
### v5.1.0
47+
- Make the query object returned from `client.query` implement the promise interface. This is the first step towards promisifying more of the node-postgres api.
48+
49+
Example:
50+
```js
51+
var client = new Client()
52+
client.connect()
53+
client.query('SELECT $1::text as name', ['brianc'])
54+
.then(function(res) {
55+
console.log('hello from', res.rows[0])
56+
client.end()
57+
})
58+
```
59+
60+
### v5.0.0
61+
62+
#### Breaking Changes
63+
- `require('pg').native` now returns null if the native bindings cannot be found; previously, this threw an exception.
64+
65+
#### New Features
66+
- better error message when passing `undefined` as a query parameter
67+
- support for `defaults.connectionString`
68+
- support for `returnToHead` being passed to [generic pool](https://github.com/coopernurse/node-pool)
69+
70+
### v4.5.0
71+
- Add option to parse JS date objects in query parameters as [UTC](https://github.com/brianc/node-postgres/pull/943)
72+
73+
### v4.4.0
74+
- Warn to `stderr` if a named query exceeds 63 characters which is the max lenght supported by postgres.
75+
776
### v4.3.0
877
- Unpin `pg-types` semver. Allow it to float against `[email protected]`.
978

Makefile

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ all:
1313
npm install
1414

1515
help:
16-
@echo "make prepare-test-db [connectionString=postgres://<your connection string>]"
1716
@echo "make test-all [connectionString=postgres://<your connection string>]"
1817

1918
test: test-unit
2019

2120
test-all: jshint test-missing-native test-unit test-integration test-native test-binary
2221

2322

24-
udpate-npm:
23+
update-npm:
2524
@npm i npm --global
2625

2726
bench:
@@ -32,24 +31,18 @@ test-unit:
3231

3332
test-connection:
3433
@echo "***Testing connection***"
35-
@node script/test-connection.js $(params)
36-
37-
test-connection-binary:
38-
@echo "***Testing binary connection***"
39-
@node script/test-connection.js $(params) binary
34+
@node script/create-test-tables.js $(params)
4035

4136
test-missing-native:
4237
@echo "***Testing optional native install***"
4338
@rm -rf node_modules/pg-native
4439
@node test/native/missing-native.js
45-
@npm install [email protected]
46-
@node test/native/missing-native.js
4740
@rm -rf node_modules/pg-native
4841

4942
node_modules/pg-native/index.js:
5043
@npm i pg-native
5144

52-
test-native: node_modules/pg-native/index.js
45+
test-native: node_modules/pg-native/index.js test-connection
5346
@echo "***Testing native bindings***"
5447
@find test/native -name "*-tests.js" | $(node-command)
5548
@find test/integration -name "*-tests.js" | $(node-command) native
@@ -58,13 +51,12 @@ test-integration: test-connection
5851
@echo "***Testing Pure Javascript***"
5952
@find test/integration -name "*-tests.js" | $(node-command)
6053

61-
test-binary: test-connection-binary
54+
test-binary: test-connection
6255
@echo "***Testing Pure Javascript (binary)***"
6356
@find test/integration -name "*-tests.js" | $(node-command) binary
6457

65-
prepare-test-db:
66-
@echo "***Preparing the database for tests***"
67-
@find script/create-test-tables.js | $(node-command)
58+
test-pool:
59+
@find test/integration/connection-pool -name "*.js" | $(node-command) binary
6860

6961
jshint:
7062
@echo "***Starting jshint***"

0 commit comments

Comments
 (0)