1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-29 22:49:41 +03:00

Allow multiple hostaddrs to go with multiple hostnames.

Also fix two other issues, while we're at it:

* In error message on connection failure, if multiple network addresses
were given as the host option, as in "host=127.0.0.1,127.0.0.2", the
error message printed the address twice.

* If there were many more ports than hostnames, the error message would
always claim that there was one port too many, even if there was more than
one. For example, if you gave 2 hostnames and 5 ports, the error message
claimed that you gave 2 hostnames and 3 ports.

Discussion: https://www.postgresql.org/message-id/10badbc6-4d5a-a769-623a-f7ada43e14dd@iki.fi
This commit is contained in:
Heikki Linnakangas
2017-07-10 12:28:57 +03:00
parent 260ba8525a
commit 7b02ba62e9
3 changed files with 222 additions and 100 deletions

View File

@@ -304,8 +304,9 @@ typedef enum pg_conn_host_type
*/
typedef struct pg_conn_host
{
char *host; /* host name or address, or socket path */
pg_conn_host_type type; /* type of host */
char *host; /* host name or socket path */
char *hostaddr; /* host address */
char *port; /* port number for this host; if not NULL,
* overrides the PGConn's pgport */
char *password; /* password for this host, read from the