diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index f5bd6ce3a76..64acd23a941 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -865,7 +865,7 @@ PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void); Several libpq functions parse a user-specified string to obtain connection parameters. There are two accepted formats for these strings: - plain keyword = value strings + plain keyword/value strings and URIs. URIs generally follow RFC 3986, except that multi-host connection strings are allowed @@ -876,12 +876,14 @@ PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void); Keyword/Value Connection Strings - In the first format, each parameter setting is in the form - keyword = value. Spaces around the equal sign are + In the keyword/value format, each parameter setting is in the form + keyword = + value, with space(s) between settings. + Spaces around a setting's equal sign are optional. To write an empty value, or a value containing spaces, surround it - with single quotes, e.g., keyword = 'a value'. Single - quotes and backslashes within - the value must be escaped with a backslash, i.e., \' and + with single quotes, for example keyword = 'a value'. + Single quotes and backslashes within + a value must be escaped with a backslash, i.e., \' and \\. @@ -904,7 +906,19 @@ host=localhost port=5432 dbname=mydb connect_timeout=10 The general form for a connection URI is: -postgresql://[user[:password]@][host][:port][,...][/dbname][?param1=value1&...] +postgresql://userspec@hostspec/dbname?paramspec + +where userspec is: + +user:password + +and hostspec is: + +host:port,... + +and paramspec is: + +name=value&... @@ -977,7 +991,8 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname port component, in a single URI. A URI of the form postgresql://host1:port1,host2:port2,host3:port3/ is equivalent to a connection string of the form - host=host1,host2,host3 port=port1,port2,port3. Each + host=host1,host2,host3 port=port1,port2,port3. + As further described below, each host will be tried in turn until a connection is successfully established. @@ -988,8 +1003,8 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname It is possible to specify multiple hosts to connect to, so that they are tried in the given order. In the Keyword/Value format, the host, - hostaddr, and port options accept a comma-separated - list of values. The same number of elements must be given in each + hostaddr, and port options accept comma-separated + lists of values. The same number of elements must be given in each option that is specified, such that e.g., the first hostaddr corresponds to the first host name, the second hostaddr corresponds to the second host name, and so @@ -999,7 +1014,7 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname In the connection URI format, you can list multiple host:port pairs - separated by commas, in the host component of the URI. + separated by commas in the host component of the URI.