diff options
| author | Bruce Momjian | 2014-08-25 20:30:26 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2014-08-25 20:30:26 +0000 |
| commit | ebe30ad59bb2d127f576be07e036a473999c4b80 (patch) | |
| tree | d37728e245428d8df7d3e3297b6e82e64f48b493 /contrib | |
| parent | bf1c866597a0e59a30b13a66f3ae505655b61853 (diff) | |
pg_ctl, pg_upgrade: allow multiple -o/-O options, append them
Report by Pavel Raiskup
Diffstat (limited to 'contrib')
| -rw-r--r-- | contrib/pg_upgrade/option.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c index bb594dd2f69..cfc88ec03be 100644 --- a/contrib/pg_upgrade/option.c +++ b/contrib/pg_upgrade/option.c @@ -137,17 +137,35 @@ parseCommandLine(int argc, char *argv[]) break; case 'o': - old_cluster.pgopts = pg_strdup(optarg); + /* append option? */ + if (!old_cluster.pgopts) + old_cluster.pgopts = pg_strdup(optarg); + else + { + char *old_pgopts = old_cluster.pgopts; + + old_cluster.pgopts = psprintf("%s %s", old_pgopts, optarg); + free(old_pgopts); + } break; case 'O': - new_cluster.pgopts = pg_strdup(optarg); + /* append option? */ + if (!new_cluster.pgopts) + new_cluster.pgopts = pg_strdup(optarg); + else + { + char *new_pgopts = new_cluster.pgopts; + + new_cluster.pgopts = psprintf("%s %s", new_pgopts, optarg); + free(new_pgopts); + } break; /* * Someday, the port number option could be removed and passed * using -o/-O, but that requires postmaster -C to be - * supported on all old/new versions. + * supported on all old/new versions (added in PG 9.2). */ case 'p': if ((old_cluster.port = atoi(optarg)) <= 0) |
