Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 68046a2

Browse files
committed
Remove useless database name from bootstrap argument processing (including
startup and bgwriter processes), and the -y flag. It's not used anywhere.
1 parent 6bef118 commit 68046a2

File tree

4 files changed

+10
-34
lines changed

4 files changed

+10
-34
lines changed

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/postgres-ref.sgml,v 1.49 2007/01/31 23:26:04 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/postgres-ref.sgml,v 1.50 2007/02/16 02:10:07 alvherre Exp $
33
PostgreSQL documentation
44
-->
55

@@ -475,17 +475,6 @@ PostgreSQL documentation
475475
</para>
476476
</listitem>
477477
</varlistentry>
478-
479-
<varlistentry>
480-
<term><option>-y</option> <replaceable class="parameter">database</replaceable></term>
481-
<listitem>
482-
<para>
483-
Indicates that this is a subprocess started by a parent
484-
<command>postgres</command> process, and specifies the database to
485-
use. This option is for internal use only.
486-
</para>
487-
</listitem>
488-
</varlistentry>
489478
</variablelist>
490479
</refsect2>
491480

src/backend/bootstrap/bootstrap.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.231 2007/02/15 23:23:22 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.232 2007/02/16 02:10:07 alvherre Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -208,7 +208,6 @@ BootstrapMain(int argc, char *argv[])
208208
{
209209
char *progname = argv[0];
210210
int i;
211-
char *dbname;
212211
int flag;
213212
int xlogop = BS_XLOG_NOP;
214213
char *userDoption = NULL;
@@ -239,7 +238,6 @@ BootstrapMain(int argc, char *argv[])
239238
*/
240239

241240
/* Set defaults, to be overriden by explicit options below */
242-
dbname = NULL;
243241
if (!IsUnderPostmaster)
244242
InitializeGUCOptions();
245243

@@ -250,7 +248,7 @@ BootstrapMain(int argc, char *argv[])
250248
argc--;
251249
}
252250

253-
while ((flag = getopt(argc, argv, "B:c:d:D:Fr:x:y:-:")) != -1)
251+
while ((flag = getopt(argc, argv, "B:c:d:D:Fr:x:-:")) != -1)
254252
{
255253
switch (flag)
256254
{
@@ -282,9 +280,6 @@ BootstrapMain(int argc, char *argv[])
282280
case 'x':
283281
xlogop = atoi(optarg);
284282
break;
285-
case 'y':
286-
dbname = strdup(optarg);
287-
break;
288283
case 'c':
289284
case '-':
290285
{
@@ -320,12 +315,7 @@ BootstrapMain(int argc, char *argv[])
320315
}
321316
}
322317

323-
if (!dbname && argc - optind == 1)
324-
{
325-
dbname = argv[optind];
326-
optind++;
327-
}
328-
if (!dbname || argc != optind)
318+
if (argc != optind)
329319
{
330320
write_stderr("%s: invalid command-line arguments\n", progname);
331321
proc_exit(1);
@@ -449,7 +439,7 @@ BootstrapMain(int argc, char *argv[])
449439
* Do backend-like initialization for bootstrap mode
450440
*/
451441
InitProcess();
452-
(void) InitPostgres(dbname, InvalidOid, NULL, NULL);
442+
(void) InitPostgres(NULL, InvalidOid, NULL, NULL);
453443

454444
/*
455445
* In NOP mode, all we really want to do is create shared memory and

src/backend/postmaster/postmaster.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.522 2007/02/15 23:23:23 alvherre Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.523 2007/02/16 02:10:07 alvherre Exp $
4141
*
4242
* NOTES
4343
*
@@ -3729,9 +3729,6 @@ StartChildProcess(int xlop)
37293729
snprintf(xlbuf, sizeof(xlbuf), "-x%d", xlop);
37303730
av[ac++] = xlbuf;
37313731

3732-
av[ac++] = "-y";
3733-
av[ac++] = "template1";
3734-
37353732
av[ac] = NULL;
37363733
Assert(ac < lengthof(av));
37373734

src/bin/initdb/initdb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.132 2007/02/10 14:58:55 petere Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.133 2007/02/16 02:10:07 alvherre Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -1186,7 +1186,7 @@ test_config_settings(void)
11861186
"-c max_connections=%d "
11871187
"-c shared_buffers=%d "
11881188
"-c max_fsm_pages=%d "
1189-
"template1 < \"%s\" > \"%s\" 2>&1%s",
1189+
"< \"%s\" > \"%s\" 2>&1%s",
11901190
SYSTEMQUOTE, backend_exec, boot_options,
11911191
test_conns, test_buffs, test_max_fsm,
11921192
DEVNULL, DEVNULL, SYSTEMQUOTE);
@@ -1221,7 +1221,7 @@ test_config_settings(void)
12211221
"-c max_connections=%d "
12221222
"-c shared_buffers=%d "
12231223
"-c max_fsm_pages=%d "
1224-
"template1 < \"%s\" > \"%s\" 2>&1%s",
1224+
"< \"%s\" > \"%s\" 2>&1%s",
12251225
SYSTEMQUOTE, backend_exec, boot_options,
12261226
n_connections, test_buffs, test_max_fsm,
12271227
DEVNULL, DEVNULL, SYSTEMQUOTE);
@@ -1455,7 +1455,7 @@ bootstrap_template1(char *short_version)
14551455
unsetenv("PGCLIENTENCODING");
14561456

14571457
snprintf(cmd, sizeof(cmd),
1458-
"\"%s\" --boot -x1 %s %s template1",
1458+
"\"%s\" --boot -x1 %s %s",
14591459
backend_exec, boot_options, talkargs);
14601460

14611461
PG_CMD_OPEN;

0 commit comments

Comments
 (0)