Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL := /bin/bash

connectionString=pg://
connectionString=postgres://

params := $(connectionString)

Expand All @@ -13,15 +13,15 @@ all:
npm install

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

test: test-unit

test-all: jshint test-unit test-integration test-native test-binary

test-travis: test-all upgrade-pg
@make test-all connectionString=pg://postgres@localhost:5433/postgres
@make test-all connectionString=postgres://postgres@localhost:5433/postgres

upgrade-pg:
@chmod 755 script/travis-pg-9.2-install.sh
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var pg = require('pg');
//or native libpq bindings
//var pg = require('pg').native

var conString = "tcp://postgres:1234@localhost/postgres";
var conString = "postgres://postgres:1234@localhost/postgres";

var client = new pg.Client(conString);
client.connect(function(err) {
Expand All @@ -44,7 +44,7 @@ Typically you will access the PostgreSQL server through a pool of clients. node

```javascript
var pg = require('pg');
var conString = "tcp://postgres:1234@localhost/postgres";
var conString = "postgres://postgres:1234@localhost/postgres";

pg.connect(conString, function(err, client, done) {
if(err) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"semver": "~1.1.4"
},
"scripts": {
"test": "make test-travis connectionString=pg://postgres@localhost:5432/postgres",
"test": "make test-travis connectionString=postgres://postgres@localhost:5432/postgres",
"install": "node-gyp rebuild || (exit 0)"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion script/travis-pg-9.2-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ sudo echo "host all all 0.0.0.0 255.255.255.255 trust" >> /et
sudo /etc/init.d/postgresql restart
# for some reason both postgres 9.1 and 9.2 are started
# 9.2 is running on port 5433
node script/create-test-tables.js pg://postgres@localhost:5433/postgres
node script/create-test-tables.js postgres://postgres@localhost:5433/postgres
2 changes: 1 addition & 1 deletion test/integration/client/error-handling-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ test('multiple connection errors (gh#31)', function() {
});

test('with callback method', function() {
var badConString = "tcp://aslkdfj:oi14081@"+helper.args.host+":"+helper.args.port+"/"+helper.args.database;
var badConString = "postgres://aslkdfj:oi14081@"+helper.args.host+":"+helper.args.port+"/"+helper.args.database;
return false;
});
});
Expand Down
6 changes: 3 additions & 3 deletions test/unit/client/configuration-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('client settings', function() {
test('initializing from a config string', function() {

test('uses the correct values from the config string', function() {
var client = new Client("pg://brian:pass@host1:333/databasename")
var client = new Client("postgres://brian:pass@host1:333/databasename")
assert.equal(client.user, 'brian')
assert.equal(client.password, "pass")
assert.equal(client.host, "host1")
Expand All @@ -40,7 +40,7 @@ test('initializing from a config string', function() {
})

test('uses the correct values from the config string with space in password', function() {
var client = new Client("pg://brian:pass word@host1:333/databasename")
var client = new Client("postgres://brian:pass word@host1:333/databasename")
assert.equal(client.user, 'brian')
assert.equal(client.password, "pass word")
assert.equal(client.host, "host1")
Expand All @@ -49,7 +49,7 @@ test('initializing from a config string', function() {
})

test('when not including all values the defaults are used', function() {
var client = new Client("pg://host1")
var client = new Client("postgres://host1")
assert.equal(client.user, process.env['PGUSER'] || process.env.USER)
assert.equal(client.password, process.env['PGPASSWORD'] || null)
assert.equal(client.host, "host1")
Expand Down
6 changes: 3 additions & 3 deletions test/unit/connection-parameters/creation-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for(var key in process.env) {
test('ConnectionParameters construction', function() {
assert.ok(new ConnectionParameters(), 'with null config');
assert.ok(new ConnectionParameters({user: 'asdf'}), 'with config object');
assert.ok(new ConnectionParameters('pg://localhost/postgres'), 'with connection string');
assert.ok(new ConnectionParameters('postgres://localhost/postgres'), 'with connection string');
});

var compare = function(actual, expected, type) {
Expand Down Expand Up @@ -145,13 +145,13 @@ test('libpq connection string building', function() {
host: 'localhost',
database: 'postgres'
}
var connectionString = 'pg://' + sourceConfig.user + ':' + sourceConfig.password + '@' + sourceConfig.host + ':' + sourceConfig.port + '/' + sourceConfig.database;
var connectionString = 'postgres://' + sourceConfig.user + ':' + sourceConfig.password + '@' + sourceConfig.host + ':' + sourceConfig.port + '/' + sourceConfig.database;
var subject = new ConnectionParameters(connectionString);
assert.equal(subject.password, sourceConfig.password);
});

test('password contains weird characters', function() {
var strang = 'pg://my first name:is&%awesome!@localhost:9000';
var strang = 'postgres://my first name:is&%awesome!@localhost:9000';
var subject = new ConnectionParameters(strang);
assert.equal(subject.user, 'my first name');
assert.equal(subject.password, 'is&%awesome!');
Expand Down
2 changes: 1 addition & 1 deletion test/unit/pool/basic-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test('pool creates pool on miss', function() {
var p2 = pools.getOrCreate();
assert.equal(p, p2);
assert.equal(Object.keys(pools.all).length, 1);
var p3 = pools.getOrCreate("pg://postgres:password@localhost:5432/postgres");
var p3 = pools.getOrCreate("postgres://postgres:password@localhost:5432/postgres");
assert.notEqual(p, p3);
assert.equal(Object.keys(pools.all).length, 2);
});
Expand Down