mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Add -d option to pg_basebackup and pg_receivexlog, for connection string.
Without this, there's no way to pass arbitrary libpq connection parameters to these applications. It's a bit strange that the option is called -d/--dbname, when in fact you can *not* pass a database name in it, but it's consistent with other client applications where a connection string is also passed using -d. Original patch by Amit Kapila, heavily modified by me.
This commit is contained in:
@@ -126,6 +126,7 @@ usage(void)
|
||||
printf(_(" -V, --version output version information, then exit\n"));
|
||||
printf(_(" -?, --help show this help, then exit\n"));
|
||||
printf(_("\nConnection options:\n"));
|
||||
printf(_(" -d, --dbname=CONNSTR connection string\n"));
|
||||
printf(_(" -h, --host=HOSTNAME database server host or socket directory\n"));
|
||||
printf(_(" -p, --port=PORT database server port number\n"));
|
||||
printf(_(" -s, --status-interval=INTERVAL\n"
|
||||
@@ -1540,6 +1541,7 @@ main(int argc, char **argv)
|
||||
{"gzip", no_argument, NULL, 'z'},
|
||||
{"compress", required_argument, NULL, 'Z'},
|
||||
{"label", required_argument, NULL, 'l'},
|
||||
{"dbname", required_argument, NULL, 'd'},
|
||||
{"host", required_argument, NULL, 'h'},
|
||||
{"port", required_argument, NULL, 'p'},
|
||||
{"username", required_argument, NULL, 'U'},
|
||||
@@ -1572,7 +1574,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
while ((c = getopt_long(argc, argv, "D:F:RxX:l:zZ:c:h:p:U:s:wWvP",
|
||||
while ((c = getopt_long(argc, argv, "D:F:RxX:l:zZ:d:c:h:p:U:s:wWvP",
|
||||
long_options, &option_index)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
@@ -1663,6 +1665,9 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
connection_string = pg_strdup(optarg);
|
||||
break;
|
||||
case 'h':
|
||||
dbhost = pg_strdup(optarg);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user