Skip to content

Commit 7c21815

Browse files
committed
Merge pull request brianc#407 from deafbybeheading/canonical-url
Use the standard postgres:// URL prefix for consistency
2 parents 78c0456 + 816e9b4 commit 7c21815

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHELL := /bin/bash
22

3-
connectionString=pg://
3+
connectionString=postgres://
44

55
params := $(connectionString)
66

@@ -13,15 +13,15 @@ all:
1313
npm install
1414

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

1919
test: test-unit
2020

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

2323
test-travis: test-all upgrade-pg
24-
@make test-all connectionString=pg://postgres@localhost:5433/postgres
24+
@make test-all connectionString=postgres://postgres@localhost:5433/postgres
2525

2626
upgrade-pg:
2727
@chmod 755 script/travis-pg-9.2-install.sh

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var pg = require('pg');
1919
//or native libpq bindings
2020
//var pg = require('pg').native
2121

22-
var conString = "tcp://postgres:1234@localhost/postgres";
22+
var conString = "postgres://postgres:1234@localhost/postgres";
2323

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

4545
```javascript
4646
var pg = require('pg');
47-
var conString = "tcp://postgres:1234@localhost/postgres";
47+
var conString = "postgres://postgres:1234@localhost/postgres";
4848

4949
pg.connect(conString, function(err, client, done) {
5050
if(err) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"semver": "~1.1.4"
2828
},
2929
"scripts": {
30-
"test": "make test-travis connectionString=pg://postgres@localhost:5432/postgres",
30+
"test": "make test-travis connectionString=postgres://postgres@localhost:5432/postgres",
3131
"install": "node-gyp rebuild || (exit 0)"
3232
},
3333
"engines": {

script/travis-pg-9.2-install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ sudo echo "host all all 0.0.0.0 255.255.255.255 trust" >> /et
1717
sudo /etc/init.d/postgresql restart
1818
# for some reason both postgres 9.1 and 9.2 are started
1919
# 9.2 is running on port 5433
20-
node script/create-test-tables.js pg://postgres@localhost:5433/postgres
20+
node script/create-test-tables.js postgres://postgres@localhost:5433/postgres

test/integration/client/error-handling-tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ test('multiple connection errors (gh#31)', function() {
163163
});
164164

165165
test('with callback method', function() {
166-
var badConString = "tcp://aslkdfj:oi14081@"+helper.args.host+":"+helper.args.port+"/"+helper.args.database;
166+
var badConString = "postgres://aslkdfj:oi14081@"+helper.args.host+":"+helper.args.port+"/"+helper.args.database;
167167
return false;
168168
});
169169
});

test/unit/client/configuration-tests.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test('client settings', function() {
3131
test('initializing from a config string', function() {
3232

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

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

5151
test('when not including all values the defaults are used', function() {
52-
var client = new Client("pg://host1")
52+
var client = new Client("postgres://host1")
5353
assert.equal(client.user, process.env['PGUSER'] || process.env.USER)
5454
assert.equal(client.password, process.env['PGPASSWORD'] || null)
5555
assert.equal(client.host, "host1")

test/unit/connection-parameters/creation-tests.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ for(var key in process.env) {
1111
test('ConnectionParameters construction', function() {
1212
assert.ok(new ConnectionParameters(), 'with null config');
1313
assert.ok(new ConnectionParameters({user: 'asdf'}), 'with config object');
14-
assert.ok(new ConnectionParameters('pg://localhost/postgres'), 'with connection string');
14+
assert.ok(new ConnectionParameters('postgres://localhost/postgres'), 'with connection string');
1515
});
1616

1717
var compare = function(actual, expected, type) {
@@ -145,13 +145,13 @@ test('libpq connection string building', function() {
145145
host: 'localhost',
146146
database: 'postgres'
147147
}
148-
var connectionString = 'pg://' + sourceConfig.user + ':' + sourceConfig.password + '@' + sourceConfig.host + ':' + sourceConfig.port + '/' + sourceConfig.database;
148+
var connectionString = 'postgres://' + sourceConfig.user + ':' + sourceConfig.password + '@' + sourceConfig.host + ':' + sourceConfig.port + '/' + sourceConfig.database;
149149
var subject = new ConnectionParameters(connectionString);
150150
assert.equal(subject.password, sourceConfig.password);
151151
});
152152

153153
test('password contains weird characters', function() {
154-
var strang = 'pg://my first name:is&%awesome!@localhost:9000';
154+
var strang = 'postgres://my first name:is&%awesome!@localhost:9000';
155155
var subject = new ConnectionParameters(strang);
156156
assert.equal(subject.user, 'my first name');
157157
assert.equal(subject.password, 'is&%awesome!');

test/unit/pool/basic-tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test('pool creates pool on miss', function() {
5454
var p2 = pools.getOrCreate();
5555
assert.equal(p, p2);
5656
assert.equal(Object.keys(pools.all).length, 1);
57-
var p3 = pools.getOrCreate("pg://postgres:password@localhost:5432/postgres");
57+
var p3 = pools.getOrCreate("postgres://postgres:password@localhost:5432/postgres");
5858
assert.notEqual(p, p3);
5959
assert.equal(Object.keys(pools.all).length, 2);
6060
});

0 commit comments

Comments
 (0)