diff options
| author | Heikki Linnakangas | 2013-02-25 12:48:27 +0000 |
|---|---|---|
| committer | Heikki Linnakangas | 2013-02-25 12:59:33 +0000 |
| commit | aa05c37e823a41056273e73f6b3d168009a67c3f (patch) | |
| tree | 984b4da2ff71ffc6a4df286567428eba65cb92de /src/bin/pg_basebackup/pg_basebackup.c | |
| parent | 786170d74f30bc8d3017149dc444f3f3e29029a7 (diff) | |
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.
Diffstat (limited to 'src/bin/pg_basebackup/pg_basebackup.c')
| -rw-r--r-- | src/bin/pg_basebackup/pg_basebackup.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index fb5a1bd1c19..2de03acabd6 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -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; |
