From 6a0c6ea5883f2cc4780e930fc3cc18243a067af8 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Sat, 13 Sep 2014 09:26:21 -0700 Subject: [PATCH 01/14] bump pg-connection-string to support relative urls for database name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 58b7cea00..1fc65fbf1 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "pgpass": "0.0.3", "nan": "~1.3.0", "packet-reader": "0.2.0", - "pg-connection-string": "0.1.1", + "pg-connection-string": "0.1.2", "pg-types": "1.4.0" }, "devDependencies": { From 60d5ab6abb2f65dce121598e2a048dff7977f3f8 Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Thu, 18 Sep 2014 00:24:13 -0400 Subject: [PATCH 02/14] Use 'bindings' module --- lib/native/index.js | 11 +---------- package.json | 7 ++++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/native/index.js b/lib/native/index.js index bb29d6f64..1e1d44602 100644 --- a/lib/native/index.js +++ b/lib/native/index.js @@ -6,16 +6,7 @@ var CopyFromStream = require(__dirname + '/../copystream').CopyFromStream; var CopyToStream = require(__dirname + '/../copystream').CopyToStream; var JsClient = require(__dirname + '/../client'); // used to import JS escape functions -var binding; - -//TODO remove on v1.0.0 -try { - //v0.5.x - binding = require(__dirname + '/../../build/Release/binding.node'); -} catch(e) { - //v0.4.x - binding = require(__dirname + '/../../build/default/binding'); -} +var binding = require('bindings')('binding.node'); var Connection = binding.Connection; var NativeQuery = require(__dirname + '/query'); diff --git a/package.json b/package.json index 1fc65fbf1..fa203448c 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,14 @@ "author": "Brian Carlson ", "main": "./lib", "dependencies": { - "generic-pool": "2.1.1", + "bindings": "^1.2.1", "buffer-writer": "1.0.0", - "pgpass": "0.0.3", + "generic-pool": "2.1.1", "nan": "~1.3.0", "packet-reader": "0.2.0", "pg-connection-string": "0.1.2", - "pg-types": "1.4.0" + "pg-types": "1.4.0", + "pgpass": "0.0.3" }, "devDependencies": { "jshint": "2.5.2", From f0d91e79aade21e62c882fde8c6278c50bac1de1 Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Thu, 18 Sep 2014 00:24:25 -0400 Subject: [PATCH 03/14] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fa203448c..acc0adf5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pg", - "version": "3.4.2", + "version": "3.4.3", "description": "PostgreSQL client - pure javascript & libpq with the same API", "keywords": [ "postgres", From aada94da6b9be443b5525467b29dd0127495c36e Mon Sep 17 00:00:00 2001 From: jeromew Date: Thu, 18 Sep 2014 11:27:22 +0200 Subject: [PATCH 04/14] Add Close/CloseComplete messages of wire protocol --- lib/connection.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/connection.js b/lib/connection.js index 94f97a8eb..cc23343aa 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -300,6 +300,11 @@ Connection.prototype.end = function() { this._send(0x58); }; +Connection.prototype.close = function(msg, more) { + this.writer.addCString(msg.type + (msg.name || '')); + this._send(0x43, more); +}; + Connection.prototype.describe = function(msg, more) { this.writer.addCString(msg.type + (msg.name || '')); this._send(0x44, more); @@ -364,6 +369,9 @@ Connection.prototype.parseMessage = function(buffer) { case 0x32: //2 return new Message('bindComplete', length); + case 0x33: //3 + return new Message('closeComplete', length); + case 0x41: //A return this.parseA(buffer, length); From 74c6ebed315367605849b15d0c4e96a9464fce00 Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Thu, 18 Sep 2014 15:32:41 -0400 Subject: [PATCH 05/14] Make sure all dependencies are pinned exactly --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index acc0adf5f..ad8beeea6 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,10 @@ "author": "Brian Carlson ", "main": "./lib", "dependencies": { - "bindings": "^1.2.1", + "bindings": "1.2.1", "buffer-writer": "1.0.0", "generic-pool": "2.1.1", - "nan": "~1.3.0", + "nan": "1.3.0", "packet-reader": "0.2.0", "pg-connection-string": "0.1.2", "pg-types": "1.4.0", From 8fc2aafb66e39aff1e1d1f4d9920852262c9233e Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Thu, 18 Sep 2014 15:32:49 -0400 Subject: [PATCH 06/14] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ad8beeea6..46d7b63bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pg", - "version": "3.4.3", + "version": "3.4.4", "description": "PostgreSQL client - pure javascript & libpq with the same API", "keywords": [ "postgres", From 0e411dd79bd5a7e08376bb158f08afcebaf0ff7f Mon Sep 17 00:00:00 2001 From: Alexander Schepanovski Date: Fri, 19 Sep 2014 11:19:34 +0800 Subject: [PATCH 07/14] Add pg-bricks to README Extras Adding this would be consistent since you list node-any-db and sql-bricks. I chose a position in a list assuming you move from more node-postgres specific to general and abstract. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8062c8c33..0edefa3aa 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ node-postgres is by design _low level_ with the bare minimum of abstraction. Th - [brianc/node-pg-copy-streams](https://github.com/brianc/node-pg-copy-streams) - COPY FROM / COPY TO for node-postgres. Stream from one database to another, and stuff. - [brianc/node-postgres-pure](https://github.com/brianc/node-postgres-pure) - node-postgres without any of the C/C++ stuff - [brianc/node-pg-types](https://github.com/brianc/node-pg-types) - Type parsing for node-postgres +- [Suor/pg-bricks](https://github.com/Suor/pg-bricks) - A higher level wrapper around node-postgres to handle connection settings, sql generation, transactions and ease data access. - [grncdr/node-any-db](https://github.com/grncdr/node-any-db) - Thin and less-opinionated database abstraction layer for node. - [brianc/node-sql](https://github.com/brianc/node-sql) - SQL generation for node.js - [hiddentao/suqel](https://hiddentao.github.io/squel/) - SQL query string builder for Javascript From 7f8331f96a9069b25c9be3aa680acf0eb1ce6603 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Fri, 26 Sep 2014 14:26:41 -0700 Subject: [PATCH 08/14] bump pg-connection-string to support colons in password --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 46d7b63bd..28786d01c 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "generic-pool": "2.1.1", "nan": "1.3.0", "packet-reader": "0.2.0", - "pg-connection-string": "0.1.2", + "pg-connection-string": "0.1.3", "pg-types": "1.4.0", "pgpass": "0.0.3" }, From 759d94f8b249dc72a1299d4b396d46535e112af3 Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Sat, 27 Sep 2014 12:33:54 -0400 Subject: [PATCH 09/14] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 28786d01c..87f736478 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pg", - "version": "3.4.4", + "version": "3.4.5", "description": "PostgreSQL client - pure javascript & libpq with the same API", "keywords": [ "postgres", From b1269b34978b5fac2d625e067396274ceda408cd Mon Sep 17 00:00:00 2001 From: Pierre Rochard Date: Sat, 27 Sep 2014 21:01:55 -0400 Subject: [PATCH 10/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0edefa3aa..3e1cbded2 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Documentation is a work in progress primarily taking place on the github WIKI ## Native Bindings -node-postgres contains a pure JavaScript driver and also exposes JavaScript bindings to libpq. You can use either interface. I personally use the JavaScript bindings as the are quite fast, and I like having everything implemented in JavaScript. +node-postgres contains a pure JavaScript driver and also exposes JavaScript bindings to libpq. You can use either interface. I personally use the JavaScript bindings as they are quite fast, and I like having everything implemented in JavaScript. To use native libpq bindings replace `require('pg')` with `require('pg').native`. If you __do not__ need or want the native bindings at all, consider using [node-postgres-pure](https://github.com/brianc/node-postgres-pure) instead which does not include them. From 70fcc8a676302bc063654154f6502f219e836a7b Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Wed, 1 Oct 2014 14:34:26 -0400 Subject: [PATCH 11/14] Bump version of pg-types to support boolean arrays --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 87f736478..4f1b8d0b6 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "nan": "1.3.0", "packet-reader": "0.2.0", "pg-connection-string": "0.1.3", - "pg-types": "1.4.0", + "pg-types": "1.5.0", "pgpass": "0.0.3" }, "devDependencies": { From 69ea860deb63a07c5c914fcade9bd7cbeb0ebc70 Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Wed, 1 Oct 2014 14:42:06 -0400 Subject: [PATCH 12/14] Update news --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 9cf408d0b..aa1167ecd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,9 @@ For richer information consult the commit log on github with referenced pull req We do not include break-fix version release in this file. +### v3.5.0 +- Include support for parsing boolean arrays + ### v3.4.0 - Include port as connection parameter to [unix sockets](https://github.com/brianc/node-postgres/pull/604) - Better support for odd [date parsing](https://github.com/brianc/node-pg-types/pull/8) From a57193ff32e6b3aea96c1c004105fc98583e4dc8 Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Wed, 1 Oct 2014 14:42:29 -0400 Subject: [PATCH 13/14] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4f1b8d0b6..b3d848448 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pg", - "version": "3.4.5", + "version": "3.5.0", "description": "PostgreSQL client - pure javascript & libpq with the same API", "keywords": [ "postgres", From aec3407a982dfdafbedcfdca2d68e59487b69248 Mon Sep 17 00:00:00 2001 From: Brian C Date: Thu, 9 Oct 2014 22:55:27 -0400 Subject: [PATCH 14/14] Update README.md --- README.md | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 3e1cbded2..f87d810db 100644 --- a/README.md +++ b/README.md @@ -8,18 +8,12 @@ PostgreSQL client for node.js. Pure JavaScript and native libpq bindings. npm install pg -### Windows - - 1. Install Visual Studio C++ (successfully built with Express 2010). Express is free. - 2. Add your Postgre Installation's `bin` folder to the system path (i.e. `C:\Program Files\PostgreSQL\9.3\bin`). - 3. Make sure that both `libpq.dll` and `pg_config.exe` are in that folder. - 4. `npm install pg` ## Examples ### Client pooling -Typically you will access the PostgreSQL server through a pool of clients. node-postgres ships with a built in pool to help get you up and running quickly. +Generally you will access the PostgreSQL server through a pool of clients. A client takes a non-trivial amount of time to establish a new connection. A client also consumes a non-trivial amount of resources on the PostgreSQL server - not something you want to do on every http request. Good news: node-postgres ships with built in client pooling. ```javascript var pg = require('pg'); @@ -43,6 +37,8 @@ pg.connect(conString, function(err, client, done) { ``` +[Check this out for the get up and running quickly example](https://github.com/brianc/node-postgres/wiki/Example) + ### Simple Sometimes you may not want to use a pool of connections. You can easily connect a single client to a postgres instance, run a query, and disconnect. @@ -71,15 +67,11 @@ client.connect(function(err) { ``` -## Documentation - -Documentation is a work in progress primarily taking place on the github WIKI - -### [Documentation](https://github.com/brianc/node-postgres/wiki) +## [Documentation](https://github.com/brianc/node-postgres/wiki) ## Native Bindings -node-postgres contains a pure JavaScript driver and also exposes JavaScript bindings to libpq. You can use either interface. I personally use the JavaScript bindings as they are quite fast, and I like having everything implemented in JavaScript. +node-postgres contains a pure JavaScript driver and also exposes JavaScript bindings via libpq. You can use either interface. I personally use the JavaScript bindings as they are quite fast, and I like having everything implemented in JavaScript. To use native libpq bindings replace `require('pg')` with `require('pg').native`. If you __do not__ need or want the native bindings at all, consider using [node-postgres-pure](https://github.com/brianc/node-postgres-pure) instead which does not include them. @@ -103,7 +95,7 @@ __I love contributions.__ You are welcome contribute via pull requests. If you need help getting the tests running locally feel free to email me or gchat me. I will __happily__ accept your pull request if it: -- _has tests_ +- _)has tests__ - looks reasonable - does not break backwards compatibility - satisfies jshint @@ -132,6 +124,7 @@ Follow me [@briancarlson](https://twitter.com/briancarlson) to keep up to date. node-postgres is by design _low level_ with the bare minimum of abstraction. These might help out: +- [brianc/node-pg-native](https://github.com/brianc/node-pg-native) - Simple interface abstraction on top of [libpq](https://github.com/brianc/node-libpq) - [brianc/node-pg-query-stream](https://github.com/brianc/node-pg-query-stream) - Query results from node-postgres as a readable (object) stream - [brianc/node-pg-cursor](https://github.com/brianc/node-pg-cursor) - Query cursor extension for node-postgres - [brianc/node-pg-copy-streams](https://github.com/brianc/node-pg-copy-streams) - COPY FROM / COPY TO for node-postgres. Stream from one database to another, and stuff. @@ -144,17 +137,12 @@ node-postgres is by design _low level_ with the bare minimum of abstraction. Th - [CSNW/sql-bricks](https://github.com/CSNW/sql-bricks) - Transparent, Schemaless SQL Generation -## Production Use -* [yammer.com](http://www.yammer.com) -* [bayt.com](http://bayt.com) -* [Vendly](http://www.vend.ly) -* [SaferAging](http://www.saferaging.com) -* [CartoDB](http://www.cartodb.com) -* [Heap](https://heapanalytics.com) -* [zoomsquare](http://www.zoomsquare.com/) -* [WhenToManage](http://www.whentomanage.com) - -_If you use node-postgres in production and would like your site listed here, fork & add it._ +### Windows + + 1. Install Visual Studio C++ (successfully built with Express 2010). Express is free. + 2. Add your Postgre Installation's `bin` folder to the system path (i.e. `C:\Program Files\PostgreSQL\9.3\bin`). + 3. Make sure that both `libpq.dll` and `pg_config.exe` are in that folder. + 4. `npm install pg` ## License