aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-10-08 01:36:36 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-10-08 01:36:36 +0000
commit7ca3a0f3e28e9d89d390214f6be59d7c8e88d367 (patch)
tree0c79bf0b44cbbd62eeb39380a0b45a501c75dfbf /src/backend/tcop/postgres.c
parentf4f6caa9b02af8313b3fa0f76f069b614cb98095 (diff)
downloadpostgresql-7ca3a0f3e28e9d89d390214f6be59d7c8e88d367.tar.gz
postgresql-7ca3a0f3e28e9d89d390214f6be59d7c8e88d367.zip
Whack some sense into the configuration-file-location patch.
Refactor code into something reasonably understandable, cause use of the feature to not fail in standalone backends or in EXEC_BACKEND case, fix sloppy guc.c table entries, make the documentation minimally usable.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 5658e10d453..1c668445519 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.433 2004/09/26 00:26:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.434 2004/10/08 01:36:35 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -2156,7 +2156,7 @@ PostgresMain(int argc, char *argv[], const char *username)
{
int flag;
const char *dbname = NULL;
- char *userPGDATA = NULL;
+ char *userDoption = NULL;
bool secure;
int errs = 0;
int debug_flag = 0;
@@ -2226,10 +2226,7 @@ PostgresMain(int argc, char *argv[], const char *username)
EchoQuery = false;
if (!IsUnderPostmaster)
- {
InitializeGUCOptions();
- userPGDATA = getenv("PGDATA");
- }
/* ----------------
* parse command line arguments
@@ -2274,9 +2271,9 @@ PostgresMain(int argc, char *argv[], const char *username)
SetConfigOption("shared_buffers", optarg, ctx, gucsource);
break;
- case 'D': /* PGDATA directory */
+ case 'D': /* PGDATA or config directory */
if (secure)
- userPGDATA = optarg;
+ userDoption = optarg;
break;
case 'd': /* debug level */
@@ -2571,28 +2568,11 @@ PostgresMain(int argc, char *argv[], const char *username)
on_proc_exit(log_disconnections, 0);
}
- if (!IsUnderPostmaster)
- {
- if (!userPGDATA)
- {
- write_stderr("%s does not know where to find the database system data.\n"
- "You must specify the directory that contains the database system\n"
- "either by specifying the -D invocation option or by setting the\n"
- "PGDATA environment variable.\n",
- argv[0]);
- proc_exit(1);
- }
- SetDataDir(userPGDATA);
- }
- Assert(DataDir);
-
/* Acquire configuration parameters, unless inherited from postmaster */
if (!IsUnderPostmaster)
{
- ProcessConfigFile(PGC_POSTMASTER);
-
- /* If timezone is not set, determine what the OS uses */
- pg_timezone_initialize();
+ if (!SelectConfigFiles(userDoption, argv[0]))
+ proc_exit(1);
}
/*
@@ -2685,6 +2665,7 @@ PostgresMain(int argc, char *argv[], const char *username)
* Validate we have been given a reasonable-looking DataDir (if
* under postmaster, assume postmaster did this already).
*/
+ Assert(DataDir);
ValidatePgVersion(DataDir);
/*