This little patch removes the dbname argument to InitPostgres in the
bootstrap mode. It also cleans a bit of fallout: initdb uselessly
passing an unused database name, postmaster starting a dummy process,
and removes the -y option to the bootstrap process, which is
undocumented and useless.
Unless there are objections I intend to apply this shortly.
AFAICS it doesn't need a catversion bump.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
Index: src/backend/bootstrap/bootstrap.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/bootstrap/bootstrap.c,v
retrieving revision 1.231
diff -c -p -r1.231 bootstrap.c
*** src/backend/bootstrap/bootstrap.c 15 Feb 2007 23:23:22 -0000 1.231
--- src/backend/bootstrap/bootstrap.c 15 Feb 2007 23:36:19 -0000
*************** BootstrapMain(int argc, char *argv[])
*** 208,214 ****
{
char *progname = argv[0];
int i;
- char *dbname;
int flag;
int xlogop = BS_XLOG_NOP;
char *userDoption = NULL;
--- 208,213 ----
*************** BootstrapMain(int argc, char *argv[])
*** 239,245 ****
*/
/* Set defaults, to be overriden by explicit options below */
- dbname = NULL;
if (!IsUnderPostmaster)
InitializeGUCOptions();
--- 238,243 ----
*************** BootstrapMain(int argc, char *argv[])
*** 250,256 ****
argc--;
}
! while ((flag = getopt(argc, argv, "B:c:d:D:Fr:x:y:-:")) != -1)
{
switch (flag)
{
--- 248,254 ----
argc--;
}
! while ((flag = getopt(argc, argv, "B:c:d:D:Fr:x:-:")) != -1)
{
switch (flag)
{
*************** BootstrapMain(int argc, char *argv[])
*** 282,290 ****
case 'x':
xlogop = atoi(optarg);
break;
- case 'y':
- dbname = strdup(optarg);
- break;
case 'c':
case '-':
{
--- 280,285 ----
*************** BootstrapMain(int argc, char *argv[])
*** 320,331 ****
}
}
! if (!dbname && argc - optind == 1)
! {
! dbname = argv[optind];
! optind++;
! }
! if (!dbname || argc != optind)
{
write_stderr("%s: invalid command-line arguments\n", progname);
proc_exit(1);
--- 315,321 ----
}
}
! if (argc != optind)
{
write_stderr("%s: invalid command-line arguments\n", progname);
proc_exit(1);
*************** BootstrapMain(int argc, char *argv[])
*** 449,455 ****
* Do backend-like initialization for bootstrap mode
*/
InitProcess();
! (void) InitPostgres(dbname, InvalidOid, NULL, NULL);
/*
* In NOP mode, all we really want to do is create shared memory and
--- 439,445 ----
* Do backend-like initialization for bootstrap mode
*/
InitProcess();
! (void) InitPostgres(NULL, InvalidOid, NULL, NULL);
/*
* In NOP mode, all we really want to do is create shared memory and
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.522
diff -c -p -r1.522 postmaster.c
*** src/backend/postmaster/postmaster.c 15 Feb 2007 23:23:23 -0000 1.522
--- src/backend/postmaster/postmaster.c 15 Feb 2007 23:52:17 -0000
*************** StartChildProcess(int xlop)
*** 3729,3737 ****
snprintf(xlbuf, sizeof(xlbuf), "-x%d", xlop);
av[ac++] = xlbuf;
- av[ac++] = "-y";
- av[ac++] = "template1";
-
av[ac] = NULL;
Assert(ac < lengthof(av));
--- 3729,3734 ----
Index: src/bin/initdb/initdb.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/bin/initdb/initdb.c,v
retrieving revision 1.132
diff -c -p -r1.132 initdb.c
*** src/bin/initdb/initdb.c 10 Feb 2007 14:58:55 -0000 1.132
--- src/bin/initdb/initdb.c 16 Feb 2007 00:01:38 -0000
*************** test_config_settings(void)
*** 1186,1192 ****
"-c max_connections=%d "
"-c shared_buffers=%d "
"-c max_fsm_pages=%d "
! "template1 < \"%s\" > \"%s\" 2>&1%s",
SYSTEMQUOTE, backend_exec, boot_options,
test_conns, test_buffs, test_max_fsm,
DEVNULL, DEVNULL, SYSTEMQUOTE);
--- 1186,1192 ----
"-c max_connections=%d "
"-c shared_buffers=%d "
"-c max_fsm_pages=%d "
! "< \"%s\" > \"%s\" 2>&1%s",
SYSTEMQUOTE, backend_exec, boot_options,
test_conns, test_buffs, test_max_fsm,
DEVNULL, DEVNULL, SYSTEMQUOTE);
*************** test_config_settings(void)
*** 1221,1227 ****
"-c max_connections=%d "
"-c shared_buffers=%d "
"-c max_fsm_pages=%d "
! "template1 < \"%s\" > \"%s\" 2>&1%s",
SYSTEMQUOTE, backend_exec, boot_options,
n_connections, test_buffs, test_max_fsm,
DEVNULL, DEVNULL, SYSTEMQUOTE);
--- 1221,1227 ----
"-c max_connections=%d "
"-c shared_buffers=%d "
"-c max_fsm_pages=%d "
! "< \"%s\" > \"%s\" 2>&1%s",
SYSTEMQUOTE, backend_exec, boot_options,
n_connections, test_buffs, test_max_fsm,
DEVNULL, DEVNULL, SYSTEMQUOTE);
*************** bootstrap_template1(char *short_version)
*** 1455,1461 ****
unsetenv("PGCLIENTENCODING");
snprintf(cmd, sizeof(cmd),
! "\"%s\" --boot -x1 %s %s template1",
backend_exec, boot_options, talkargs);
PG_CMD_OPEN;
--- 1455,1461 ----
unsetenv("PGCLIENTENCODING");
snprintf(cmd, sizeof(cmd),
! "\"%s\" --boot -x1 %s %s",
backend_exec, boot_options, talkargs);
PG_CMD_OPEN;
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster