Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitebe30ad

Browse files
committed
pg_ctl, pg_upgrade: allow multiple -o/-O options, append them
Report by Pavel Raiskup
1 parentbf1c866 commitebe30ad

File tree

5 files changed

+39
-8
lines changed

5 files changed

+39
-8
lines changed

‎contrib/pg_upgrade/option.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff 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)

‎doc/src/sgml/pgupgrade.sgml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,16 @@
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>

‎doc/src/sgml/ref/pg_ctl-ref.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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

‎doc/src/sgml/ref/postgres-ref.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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>

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp