@@ -866,7 +866,7 @@ PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void);
866
866
<para>
867
867
Several <application>libpq</application> functions parse a user-specified string to obtain
868
868
connection parameters. There are two accepted formats for these strings:
869
- plain <literal> keyword = value</literal> strings
869
+ plain keyword/value strings
870
870
and URIs. URIs generally follow
871
871
<ulink url="https://tools.ietf.org/html/rfc3986">RFC
872
872
3986</ulink>, except that multi-host connection strings are allowed
@@ -877,12 +877,14 @@ PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void);
877
877
<title>Keyword/Value Connection Strings</title>
878
878
879
879
<para>
880
- In the first format, each parameter setting is in the form
881
- <literal>keyword = value</literal>. Spaces around the equal sign are
880
+ In the keyword/value format, each parameter setting is in the form
881
+ <replaceable>keyword</replaceable> <literal>=</literal>
882
+ <replaceable>value</replaceable>, with space(s) between settings.
883
+ Spaces around a setting's equal sign are
882
884
optional. To write an empty value, or a value containing spaces, surround it
883
- with single quotes, e.g., <literal>keyword = 'a value'</literal>. Single
884
- quotes and backslashes within
885
- the value must be escaped with a backslash, i.e., <literal>\'</literal> and
885
+ with single quotes, for example <literal>keyword = 'a value'</literal>.
886
+ Single quotes and backslashes within
887
+ a value must be escaped with a backslash, i.e., <literal>\'</literal> and
886
888
<literal>\\</literal>.
887
889
</para>
888
890
@@ -905,7 +907,19 @@ host=localhost port=5432 dbname=mydb connect_timeout=10
905
907
<para>
906
908
The general form for a connection <acronym>URI</acronym> is:
907
909
<synopsis>
908
- postgresql://[user[:password]@][host][:port][,...][/dbname][?param1=value1&...]
910
+ postgresql://<optional><replaceable>userspec</replaceable>@</optional><optional><replaceable>hostspec</replaceable></optional><optional>/<replaceable>dbname</replaceable></optional><optional>?<replaceable>paramspec</replaceable></optional>
911
+
912
+ <phrase>where <replaceable>userspec</replaceable> is:</phrase>
913
+
914
+ <replaceable>user</replaceable><optional>:<replaceable>password</replaceable></optional>
915
+
916
+ <phrase>and <replaceable>hostspec</replaceable> is:</phrase>
917
+
918
+ <optional><replaceable>host</replaceable></optional><optional>:<replaceable>port</replaceable></optional><optional>,...</optional>
919
+
920
+ <phrase>and <replaceable>paramspec</replaceable> is:</phrase>
921
+
922
+ <replaceable>name</replaceable>=<replaceable>value</replaceable><optional>&...</optional>
909
923
</synopsis>
910
924
</para>
911
925
@@ -978,7 +992,8 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
978
992
port component, in a single URI. A URI of the form
979
993
<literal>postgresql://host1:port1,host2:port2,host3:port3/</literal>
980
994
is equivalent to a connection string of the form
981
- <literal>host=host1,host2,host3 port=port1,port2,port3</literal>. Each
995
+ <literal>host=host1,host2,host3 port=port1,port2,port3</literal>.
996
+ As further described below, each
982
997
host will be tried in turn until a connection is successfully established.
983
998
</para>
984
999
</sect3>
@@ -989,8 +1004,8 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
989
1004
<para>
990
1005
It is possible to specify multiple hosts to connect to, so that they are
991
1006
tried in the given order. In the Keyword/Value format, the <literal>host</literal>,
992
- <literal>hostaddr</literal>, and <literal>port</literal> options accept a comma-separated
993
- list of values. The same number of elements must be given in each
1007
+ <literal>hostaddr</literal>, and <literal>port</literal> options accept comma-separated
1008
+ lists of values. The same number of elements must be given in each
994
1009
option that is specified, such
995
1010
that e.g., the first <literal>hostaddr</literal> corresponds to the first host name,
996
1011
the second <literal>hostaddr</literal> corresponds to the second host name, and so
@@ -1000,7 +1015,7 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
1000
1015
1001
1016
<para>
1002
1017
In the connection URI format, you can list multiple <literal>host:port</literal> pairs
1003
- separated by commas, in the <literal>host</literal> component of the URI.
1018
+ separated by commas in the <literal>host</literal> component of the URI.
1004
1019
</para>
1005
1020
1006
1021
<para>
0 commit comments