Re: Proposal: Implement failover on libpq connect level. - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: Proposal: Implement failover on libpq connect level.
Date
Msg-id 20150903171113.GL3685@tamriel.snowman.net
Whole thread Raw
In response to Re: Proposal: Implement failover on libpq connect level.  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
* Alvaro Herrera (alvherre@2ndquadrant.com) wrote:
> Shulgin, Oleksandr wrote:
>
> > > Alternatively, change the rules for parsing the existing host=X
> > > parameter so that we split it on some separator that isn't a valid
> > > hostname character, and then strip off an optional :port syntax from
> > > each entry; that value, if present, overrides port=X for that entry.
> >
> > It's tempting to use ':' as the separator here, but it's still valid for
> > directory names and host can be one in case of UN*X sockets.
>
> I think that's rare enough that we could just say that if you want to
> have a : in a directory name used for local connections, you have to
> escape the : character.  This is going to be pretty easy to detect as a
> problem because of the obvious error message ("cannot parse "pg" in
> /usr/sockets:pg as a port number"), except in the even rarer case that
> the only stuff after the colon is digits.

If we really want to worry about this, we could simply check if the
directory exists with the ':5433' or whatever at the end and, if it
does, use whatever the port specification is.  If that directory doesn't
exist, and one without the ':5433' does, then we try that directory and
that port.

Personally, I agree with Alvaro that it's really just overkill to worry
about though.

Thanks!

Stephen

pgsql-hackers by date:

Previous
From: Christopher Browne
Date:
Subject: Re: Proposal: Implement failover on libpq connect level.
Next
From: Josh Berkus
Date:
Subject: Re: Horizontal scalability/sharding