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_receivexlog.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_receivexlog.c')
-rw-r--r-- | src/bin/pg_basebackup/pg_receivexlog.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c index 33dbc50389b..352ff353768 100644 --- a/src/bin/pg_basebackup/pg_receivexlog.c +++ b/src/bin/pg_basebackup/pg_receivexlog.c @@ -58,6 +58,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" @@ -306,6 +307,7 @@ main(int argc, char **argv) {"help", no_argument, NULL, '?'}, {"version", no_argument, NULL, 'V'}, {"directory", required_argument, NULL, 'D'}, + {"dbname", required_argument, NULL, 'd'}, {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, @@ -338,7 +340,7 @@ main(int argc, char **argv) } } - while ((c = getopt_long(argc, argv, "D:h:p:U:s:nwWv", + while ((c = getopt_long(argc, argv, "D:d:h:p:U:s:nwWv", long_options, &option_index)) != -1) { switch (c) @@ -346,6 +348,9 @@ main(int argc, char **argv) case 'D': basedir = pg_strdup(optarg); break; + case 'd': + connection_string = pg_strdup(optarg); + break; case 'h': dbhost = pg_strdup(optarg); break; |