File tree Expand file tree Collapse file tree 5 files changed +39
-8
lines changed Expand file tree Collapse file tree 5 files changed +39
-8
lines changed Original file line number Diff line number Diff line change @@ -137,17 +137,35 @@ parseCommandLine(int argc, char *argv[])
137137 break ;
138138
139139 case 'o' :
140- old_cluster .pgopts = pg_strdup (optarg );
140+ /* append option? */
141+ if (!old_cluster .pgopts )
142+ old_cluster .pgopts = pg_strdup (optarg );
143+ else
144+ {
145+ char * old_pgopts = old_cluster .pgopts ;
146+
147+ old_cluster .pgopts = psprintf ("%s %s" , old_pgopts , optarg );
148+ free (old_pgopts );
149+ }
141150 break ;
142151
143152 case 'O' :
144- new_cluster .pgopts = pg_strdup (optarg );
153+ /* append option? */
154+ if (!new_cluster .pgopts )
155+ new_cluster .pgopts = pg_strdup (optarg );
156+ else
157+ {
158+ char * new_pgopts = new_cluster .pgopts ;
159+
160+ new_cluster .pgopts = psprintf ("%s %s" , new_pgopts , optarg );
161+ free (new_pgopts );
162+ }
145163 break ;
146164
147165 /*
148166 * Someday, the port number option could be removed and passed
149167 * using -o/-O, but that requires postmaster -C to be
150- * supported on all old/new versions.
168+ * supported on all old/new versions (added in PG 9.2) .
151169 */
152170 case 'p' :
153171 if ((old_cluster .port = atoi (optarg )) <= 0 )
Original file line number Diff line number Diff line change 130130 <term><option>-o</option> <replaceable class="parameter">options</replaceable></term>
131131 <term><option>--old-options</option> <replaceable class="parameter">options</replaceable></term>
132132 <listitem><para>options to be passed directly to the
133- old <command>postgres</command> command</para></listitem>
133+ old <command>postgres</command> command; multiple
134+ option invocations are appended</para></listitem>
134135 </varlistentry>
135136
136137 <varlistentry>
137138 <term><option>-O</option> <replaceable class="parameter">options</replaceable></term>
138139 <term><option>--new-options</option> <replaceable class="parameter">options</replaceable></term>
139140 <listitem><para>options to be passed directly to the
140- new <command>postgres</command> command</para></listitem>
141+ new <command>postgres</command> command; multiple
142+ option invocations are appended</para></listitem>
141143 </varlistentry>
142144
143145 <varlistentry>
Original file line number Diff line number Diff line change @@ -302,7 +302,8 @@ PostgreSQL documentation
302302 <listitem>
303303 <para>
304304 Specifies options to be passed directly to the
305- <command>postgres</command> command.
305+ <command>postgres</command> command; multiple
306+ option invocations are appended.
306307 </para>
307308 <para>
308309 The options should usually be surrounded by single or double
Original file line number Diff line number Diff line change @@ -288,7 +288,8 @@ PostgreSQL documentation
288288 class="parameter">extra-options</replaceable> are passed to
289289 all server processes started by this
290290 <command>postgres</command> process. If the option string contains
291- any spaces, the entire string must be quoted.
291+ any spaces, the entire string must be quoted; multiple
292+ option invocations are appended.
292293 </para>
293294
294295 <para>
Original file line number Diff line number Diff line change @@ -2184,7 +2184,16 @@ main(int argc, char **argv)
21842184 register_servicename = pg_strdup (optarg );
21852185 break ;
21862186 case 'o' :
2187- post_opts = pg_strdup (optarg );
2187+ /* append option? */
2188+ if (!post_opts )
2189+ post_opts = pg_strdup (optarg );
2190+ else
2191+ {
2192+ char * old_post_opts = post_opts ;
2193+
2194+ post_opts = psprintf ("%s %s" , old_post_opts , optarg );
2195+ free (old_post_opts );
2196+ }
21882197 break ;
21892198 case 'p' :
21902199 exec_path = pg_strdup (optarg );
You can’t perform that action at this time.
0 commit comments