Re: Patch: Implement failover on libpq connect level.

Поиск
Список
Период
Сортировка
От Tsunakawa, Takayuki
Тема Re: Patch: Implement failover on libpq connect level.
Дата
Msg-id 0A3221C70F24FB45833433255569204D1F63F38B@G01JPEXMBYT05
обсуждение исходный текст
Ответ на Re: Patch: Implement failover on libpq connect level.  (Robert Haas <robertmhaas@gmail.com>)
Список 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
theresult.
 

The following literal connection strings succeeded.  host1 is a server where PostgreSQL is not running, and host2 is
whereit'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()'sparser 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
inthe 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ashutosh Bapat
Дата:
Сообщение: Re: Calculation of param_source_rels in add_paths_to_joinrel
Следующее
От: Ashutosh Bapat
Дата:
Сообщение: Re: postgres_fdw : altering foreign table not invalidating prepare statement execution plan.