Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set database on socket string connection #487

Merged
merged 1 commit into from
Dec 20, 2013
Merged

Conversation

aurium
Copy link
Contributor

@aurium aurium commented Dec 19, 2013

Allows to connect to a specific database trough this ways:

pg.connect('/some/path database', callback);
pg.connect('socket:/some/path?db=database', callback)
pg.connect('socket:/some/path?db=database&encoding=utf8', callback)

Closes issue 484

Allows to conect to a specific database trough this ways:
pg.connect('/some/path database', callback);
pg.connect('socket:/some/path?db=database', callback)
pg.connect('socket:/some/path?db=database&encoding=utf8', callback)
@aurium
Copy link
Contributor Author

aurium commented Dec 19, 2013

PS: i'm using this modification to have the same js code connecting on heroku pg and on my local system pg, using a socket string from env var, with a specific db name on my local system.

@aurium
Copy link
Contributor Author

aurium commented Dec 19, 2013

TODO: after merge, may be good to add information on pg.connect() documentation at the wiki.

@@ -47,10 +47,44 @@ test('ConnectionParameters initializing from config', function() {
assert.ok(subject.isDomainSocket === false);
});

test('escape spaces if present', function() {
subject = new ConnectionParameters('postgres://localhost/post gres');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bonus points for this!

@brianc
Copy link
Owner

brianc commented Dec 20, 2013

This is a great pull request. If you have anything else you'd like to add or change, please feel free. 😄

👍 thank you so much! 🙆‍♀️

Going to run my local test suite, merge it, document the change in the changelog, and bump the minor version.

brianc added a commit that referenced this pull request Dec 20, 2013
Set database on socket string connection
@brianc brianc merged commit aa32992 into brianc:master Dec 20, 2013
@aurium
Copy link
Contributor Author

aurium commented Dec 20, 2013

Nice! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set database on socket string connection
2 participants