Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.

Allow changing pg.defaults #240

Closed
swissspidy opened this issue Apr 23, 2016 · 3 comments · Fixed by #257
Closed

Allow changing pg.defaults #240

swissspidy opened this issue Apr 23, 2016 · 3 comments · Fixed by #257

Comments

@swissspidy
Copy link

In #51 I noted how it's not possible to change pg.defaults via Massive. node-postgres allows overriding a few defaults. Here's an example:

var pg = require('pg');
pg.defaults.poolSize = 25;

//pool is created on first call to pg.connect
pg.connect(function(err, client, done) {
  done();
});

pg.defaults.poolSize = 2;
//pool still has a size of 25
pg.connect(function(err, client, done) {
  done();
});

//creating a new pool by using a different connection string
//will create this second pool with a size of 2
pg.connect('other-pool', function(err, client, done) {

});

The runner class (DB.prototype.query and DB.prototype.stream, specifically) could be extended to allow changing these defaults.

@robconery
Copy link
Contributor

I think @dmfay we could accommodate this on startup - maybe tacking on pgDefaults option or something in the connection? Changing the poolsize is particularly interesting although the date issue referenced in #51 will cause more issues but... whatever :).

Thoughts? @xivSolutions?

@xivSolutions
Copy link
Collaborator

Agree about adding a pgDefaults _option _on start-up. There are a number of reasons that would be handy, including (for those who choose to go this route) setting the option parseInputDatesAsUTC mentioned by the OP in #51.

Pool size management is the big win here I think. As far as the date stuff, to me that's just JS quirkiness, and Massive already does the correct thing by staying out of the way and allowing the irritating, but "normal" JS behavior to remain.

@dmfay
Copy link
Owner

dmfay commented Apr 24, 2016

It'd be pretty great to be able to turn on parseInt8 and get counts back as proper numbers too! Definitely agree with John that it needs to be something the user has to explicitly enable themselves though.

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

Successfully merging a pull request may close this issue.

4 participants