Re: Patch: Implement failover on libpq connect level.
Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
From: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
To: 'Robert Haas' <robertmhaas@gmail.com>, Mithun Cy <mithun.cy@enterprisedb.com>
Cc: Peter van Hardenberg <pvh@pvh.ca>, Peter Eisentraut <peter_e@gmx.net>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2016-11-11T07:03:49Z
Lists: pgsql-hackers
From: pgsql-hackers-owner@postgresql.org > [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Robert Haas > Great, committed. There's still potentially more work to be done here, > because my patch omits some features that were present in Victor's original > submission, like setting the failover timeout, optionally randomizing the > order of the hosts, and distinguishing between master and standby servers; > Victor, or anyone, please feel free to submit separate patches for those > things. I did a few tests with ECPG. I'm satisfied with the current behavior, but someone says different. I'd like to share the result. The following literal connection strings succeeded. host1 is a server where PostgreSQL is not running, and host2 is where it's running. I could connect to the database server on host2. EXEC SQL CONNECT TO 'tcp:postgresql://host1,host2:5450/postgres'; EXEC SQL CONNECT TO 'tcp:postgresql://host1,host2:5450,5450/postgres'; EXEC SQL CONNECT TO 'postgres@host1,host2:5450'; EXEC SQL CONNECT TO 'postgres@host1,host2:5450,5450'; EXEC SQL CONNECT TO 'tcp:postgresql://?service=my_service'; ~/.pg_service.conf [my_service] host=host1,host2 port=5450 # and port=5450,5450 case dbname=postgres But this one makes PQconnectdbParams() fail, because the passed "host" is "host1:5450,host2" and "port" is "5450". ECPGconnect()'s parser is different from libpq's. However, the tcp:postgresql:// syntax is not described a URL in the manual, so I think it's sufficient to just describe the syntax in the ECPG article. EXEC SQL CONNECT TO 'tcp:postgresql://host1:5450,host2:5450/postgres'; And without the single quote like below, ecpg fails to precompile the source file. I also think it's enough to state in the manual "quote the connection target if you specify multiple hosts or ports". EXEC SQL CONNECT TO tcp:postgresql://host1,host2:5450,5450/postgres; connect.ec:12: ERROR: syntax error at or near "," Comments? Regards Takayuki Tsunakawa
Commits
-
libpq: Add target_session_attrs parameter.
- 721f7bd3cbcc 10.0 landed
-
Remove superuser checks in pgstattuple
- fd321a1dfd64 10.0 cited
-
Fix unwanted flushing of libpq's input buffer when socket EOF is seen.
- c405918858c0 9.6.0 cited