* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.117 2001/09/29 04:02:22 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.118 2001/10/19 17:03:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
SetDataDir(potential_DataDir);
}
+
+ /* Validate we have been given a reasonable-looking DataDir */
Assert(DataDir);
+ ValidatePgVersion(DataDir);
if (IsUnderPostmaster)
{
-
/*
* Properly accept or ignore signals the postmaster might send us
*/
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.246 2001/10/19 00:44:08 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.247 2001/10/19 17:03:08 tgl Exp $
*
* NOTES
*
ExitPostmaster(2);
}
+ /* Look for PG_VERSION before looking for pg_control */
+ ValidatePgVersion(checkdir);
+
snprintf(path, sizeof(path), "%s/global/pg_control", checkdir);
fp = AllocateFile(path, PG_BINARY_R);
progname, checkdir, path, strerror(errno));
ExitPostmaster(2);
}
-
FreeFile(fp);
-
- ValidatePgVersion(checkdir);
}
av[ac++] = "-d";
- sprintf(nbbuf, "-B%u", NBuffers);
+ sprintf(nbbuf, "-B%d", NBuffers);
av[ac++] = nbbuf;
- sprintf(xlbuf, "-x %d", xlop);
+ sprintf(xlbuf, "-x%d", xlop);
av[ac++] = xlbuf;
av[ac++] = "-p";
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.235 2001/10/19 00:44:08 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.236 2001/10/19 17:03:08 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
}
/*
+ * Validate we have been given a reasonable-looking DataDir
+ * (if under postmaster, assume postmaster did this already).
+ */
+ ValidatePgVersion(DataDir);
+
+ /*
* Create lockfile for data directory.
*/
if (!CreateDataDirLockFile(DataDir, false))
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.235 $ $Date: 2001/10/19 00:44:08 $\n");
+ puts("$Revision: 1.236 $ $Date: 2001/10/19 17:03:08 $\n");
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.78 2001/10/12 02:08:34 ishii Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.79 2001/10/19 17:03:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
ret = fscanf(file, "%ld.%ld", &file_major, &file_minor);
- if (ret == EOF)
- elog(FATAL, "cannot read %s: %m", full_path);
- else if (ret != 2)
- elog(FATAL, "`%s' does not have a valid format. You need to initdb.", full_path);
+ if (ret != 2)
+ elog(FATAL, "File %s does not contain valid data. You need to initdb.", full_path);
FreeFile(file);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.93 2001/09/29 04:02:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.94 2001/10/19 17:03:08 tgl Exp $
*
*
*-------------------------------------------------------------------------
char *fullpath,
datpath[MAXPGPATH];
- /* Verify if DataDir is ok */
- if (access(DataDir, F_OK) == -1)
- elog(FATAL, "Database system not found.\n\t"
- "Data directory '%s' does not exist.",
- DataDir);
-
- ValidatePgVersion(DataDir);
+ /* Formerly we validated DataDir here, but now that's done earlier. */
/*
* Find oid and path of the database we're about to open. Since
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.139 2001/10/16 20:51:35 tgl Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.140 2001/10/19 17:03:08 tgl Exp $
#
#-------------------------------------------------------------------------
rm -rf "$PGDATA"/base/1 || exit_nicely
mkdir "$PGDATA"/base/1 || exit_nicely
+# Top level PG_VERSION is checked by bootstrapper, so make it first
+echo "$short_version" > "$PGDATA/PG_VERSION" || exit_nicely
+
cat "$POSTGRES_BKI" \
| sed -e "s/POSTGRES/$POSTGRES_SUPERUSERNAME/g" \
-e "s/ENCODING/$MULTIBYTEID/g" \
| "$PGPATH"/postgres -boot -x1 $PGSQL_OPT $BACKEND_TALK_ARG template1 \
|| exit_nicely
-echo $short_version > "$PGDATA"/base/1/PG_VERSION || exit_nicely
+# Make the per-database PGVERSION for template1 only after init'ing it
+echo "$short_version" > "$PGDATA/base/1/PG_VERSION" || exit_nicely
echo "ok"
$ECHO_N "creating configuration files... "$ECHO_C
-echo $short_version > "$PGDATA/PG_VERSION" || exit_nicely
-
cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf || exit_nicely
cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf || exit_nicely
cp "$POSTGRESQL_CONF_SAMPLE" "$PGDATA"/postgresql.conf || exit_nicely