-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Multiple hosts support fix #1470 #1711
Conversation
Fix #1470 |
Looks like this is missing implementation for the pure JS driver? Also, a second module for connection string parsing that isn’t compatible with libpq connection strings AIUI doesn’t seem right vs. adding to pg-connection-string. Tests are necessary as well. |
You want to ask me for porting this logic in JS:
?
In what kind of cases? It's work with all types of documented URI except for unix sockets, for them I use previous module. |
@denchistyakov why doesn't it work with the sockets? The standard for unix sockets inside a connection string is to have the server address ending with Here's example: const parse = require('connection-string');
const cn = parse('postgres://user:[email protected]/myDB');
console.log(cn); outputs:
This means your check for the use of a socket would be as simple as: const isSocket = cn.hosts && cn.hosts[0].name && cn.hosts[0].name.endsWith('.sock'); And when your socket address contains So everything should work fine for unix sockets. You do not need to use |
For example: when there are spaces in some part. libpq handles them fine. I’m sure there are many other differences (since MongoDB and libpq are unrelated), but that’s an obvious one because tests had to be removed. |
MongoDB spec for connections strings is the most sensible one. And it requires that the server address is URL-encoded, which means spaces must be passed in as This generic approach is much safer than all the custom/proprietary ones used so far by this driver. It should finally shift towards use of the generic connection string, IMO. |
For a PostgreSQL driver? No, I think libpq’s implementation is the most sensible compatibility target. |
Is there anything blocking this functionality from being merged at this time? Is it the missing tests for this capability? A project I'm working on needs this functionality to use multiple HA-proxy layers in front of the postgres DB's, so we 'HA' the HA-proxies. |
@jimlindeman Yes, it’s missing the implementation. |
@charmander, which implementation do you mean? PG native? |
@radoslawroszkowiak Libq does support the feature natively, b.t.w., so it should be done for both at the same time, IMO. |
@radoslawroszkowiak I mean the non-pg-native implementation. The JS driver. |
No description provided.