aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/index/genam.c4
-rw-r--r--src/backend/bootstrap/bootstrap.c34
-rw-r--r--src/backend/commands/trigger.c4
-rw-r--r--src/backend/optimizer/util/plancat.c4
-rw-r--r--src/backend/postmaster/postmaster.c138
-rw-r--r--src/backend/tcop/postgres.c271
-rw-r--r--src/backend/utils/cache/relcache.c4
-rw-r--r--src/backend/utils/init/miscinit.c24
-rw-r--r--src/backend/utils/misc/guc.c58
-rw-r--r--src/bin/initdb/initdb.c10
-rw-r--r--src/include/miscadmin.h5
-rw-r--r--src/include/tcop/tcopprot.h6
12 files changed, 316 insertions, 246 deletions
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c
index 6ca2fe594bf..3b840d2bb49 100644
--- a/src/backend/access/index/genam.c
+++ b/src/backend/access/index/genam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.52 2005/12/03 05:51:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.53 2006/01/05 10:07:44 petere Exp $
*
* NOTES
* many of the old access method routines have been turned into
@@ -185,7 +185,7 @@ systable_beginscan(Relation heapRelation,
Relation irel;
if (indexOK &&
- !IsIgnoringSystemIndexes() &&
+ !IgnoreSystemIndexes &&
!ReindexIsProcessingIndex(indexId))
irel = index_open(indexId);
else
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 66cf4c4ce0a..68dd732ff1e 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.210 2006/01/04 21:06:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.211 2006/01/05 10:07:44 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -255,10 +255,13 @@ BootstrapMain(int argc, char *argv[])
argc--;
}
- while ((flag = getopt(argc, argv, "B:c:d:D:Fo:p:x:-:")) != -1)
+ while ((flag = getopt(argc, argv, "B:c:d:D:Fr:x:y:-:")) != -1)
{
switch (flag)
{
+ case 'B':
+ SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, PGC_S_ARGV);
+ break;
case 'D':
userDoption = optarg;
break;
@@ -278,18 +281,15 @@ BootstrapMain(int argc, char *argv[])
case 'F':
SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV);
break;
- case 'o':
+ case 'r':
StrNCpy(OutputFileName, optarg, MAXPGPATH);
break;
case 'x':
xlogop = atoi(optarg);
break;
- case 'p':
+ case 'y':
dbname = strdup(optarg);
break;
- case 'B':
- SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, PGC_S_ARGV);
- break;
case 'c':
case '-':
{
@@ -376,7 +376,7 @@ BootstrapMain(int argc, char *argv[])
CreateDataDirLockFile(false);
SetProcessingMode(BootstrapProcessing);
- IgnoreSystemIndexes(true);
+ IgnoreSystemIndexes = true;
BaseInit();
@@ -499,14 +499,16 @@ BootstrapMain(int argc, char *argv[])
static void
usage(void)
{
- write_stderr("Usage:\n"
- " postgres -boot [OPTION]... DBNAME\n"
- " -c NAME=VALUE set run-time parameter\n"
- " -d 1-5 debug level\n"
- " -D datadir data directory\n"
- " -F turn off fsync\n"
- " -o file send debug output to file\n"
- " -x num internal use\n");
+ fprintf(stderr, _("This is the PostgreSQL bootstrap process.\n\n"));
+ fprintf(stderr, _("Usage:\n postgres -boot [OPTION]... DBNAME\n\n"));
+ fprintf(stderr, _("Options:\n"));
+ fprintf(stderr, _(" -B NBUFFERS number of shared buffers\n"));
+ fprintf(stderr, _(" -c NAME=VALUE set run-time parameter\n"));
+ fprintf(stderr, _(" -d 1-5 debugging level\n"));
+ fprintf(stderr, _(" -D DATADIR database directory\n"));
+ fprintf(stderr, _(" -F turn fsync off\n"));
+ fprintf(stderr, _(" -r FILENAME send stdout and stderr to given file\n"));
+ fprintf(stderr, _(" -x NUM internal use\n"));
proc_exit(1);
}
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index e9ac17d148b..8a5888a4044 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.197 2005/11/22 18:17:09 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.198 2006/01/05 10:07:45 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -845,7 +845,7 @@ RelationBuildTriggers(Relation relation)
/*
* Note: since we scan the triggers using TriggerRelidNameIndexId, we will
* be reading the triggers in name order, except possibly during
- * emergency-recovery operations (ie, IsIgnoringSystemIndexes). This in
+ * emergency-recovery operations (ie, IgnoreSystemIndexes). This in
* turn ensures that triggers will be fired in name order.
*/
ScanKeyInit(&skey,
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index ec753de8ca3..d9a9fdb9cfa 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.115 2005/11/22 18:17:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.116 2006/01/05 10:07:45 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -107,7 +107,7 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel)
/*
* Make list of indexes. Ignore indexes on system catalogs if told to.
*/
- if (IsIgnoringSystemIndexes() && IsSystemClass(relation->rd_rel))
+ if (IgnoreSystemIndexes && IsSystemClass(relation->rd_rel))
hasindex = false;
else
hasindex = relation->rd_rel->relhasindex;
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 187bfeb47ec..31d370ebbb2 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.477 2006/01/04 21:06:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.478 2006/01/05 10:07:45 petere Exp $
*
* NOTES
*
@@ -432,8 +432,6 @@ PostmasterMain(int argc, char *argv[])
ALLOCSET_DEFAULT_MAXSIZE);
MemoryContextSwitchTo(PostmasterContext);
- IgnoreSystemIndexes(false);
-
if (find_my_exec(argv[0], my_exec_path) < 0)
elog(FATAL, "%s: could not locate my own executable path",
argv[0]);
@@ -447,90 +445,108 @@ PostmasterMain(int argc, char *argv[])
opterr = 1;
- while ((opt = getopt(argc, argv, "A:a:B:b:c:D:d:Fh:ik:lm:MN:no:p:Ss-:")) != -1)
+ while ((opt = getopt(argc, argv, "A:B:c:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:W:-:")) != -1)
{
switch (opt)
{
case 'A':
-#ifdef USE_ASSERT_CHECKING
SetConfigOption("debug_assertions", optarg, PGC_POSTMASTER, PGC_S_ARGV);
-#else
- write_stderr("%s: assert checking is not compiled in\n", progname);
-#endif
- break;
- case 'a':
- /* Can no longer set authentication method. */
break;
+
case 'B':
SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, PGC_S_ARGV);
break;
- case 'b':
- /* Can no longer set the backend executable file to use. */
- break;
+
case 'D':
userDoption = optarg;
break;
+
case 'd':
set_debug_options(atoi(optarg), PGC_POSTMASTER, PGC_S_ARGV);
break;
+
+ case 'E':
+ SetConfigOption("log_statement", "all", PGC_POSTMASTER, PGC_S_ARGV);
+ break;
+
+ case 'e':
+ SetConfigOption("datestyle", "euro", PGC_POSTMASTER, PGC_S_ARGV);
+ break;
+
case 'F':
SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV);
break;
+
+ case 'f':
+ if (!set_plan_disabling_options(optarg, PGC_POSTMASTER, PGC_S_ARGV))
+ {
+ write_stderr("%s: invalid argument for option -f: \"%s\"\n",
+ progname, optarg);
+ ExitPostmaster(1);
+ }
+ break;
+
case 'h':
SetConfigOption("listen_addresses", optarg, PGC_POSTMASTER, PGC_S_ARGV);
break;
+
case 'i':
SetConfigOption("listen_addresses", "*", PGC_POSTMASTER, PGC_S_ARGV);
break;
+
+ case 'j':
+ /* only used by interactive backend */
+ break;
+
case 'k':
SetConfigOption("unix_socket_directory", optarg, PGC_POSTMASTER, PGC_S_ARGV);
break;
-#ifdef USE_SSL
+
case 'l':
SetConfigOption("ssl", "true", PGC_POSTMASTER, PGC_S_ARGV);
break;
-#endif
- case 'm':
- /* Multiplexed backends no longer supported. */
- break;
- case 'M':
- /*
- * ignore this flag. This may be passed in because the
- * program was run as 'postgres -M' instead of 'postmaster'
- */
- break;
case 'N':
- /* The max number of backends to start. */
SetConfigOption("max_connections", optarg, PGC_POSTMASTER, PGC_S_ARGV);
break;
+
case 'n':
/* Don't reinit shared mem after abnormal exit */
Reinit = false;
break;
- case 'o':
- /*
- * Other options to pass to the backend on the command line
- */
+ case 'O':
+ SetConfigOption("allow_system_table_mods", "true", PGC_POSTMASTER, PGC_S_ARGV);
+ break;
+
+ case 'o':
+ /* Other options to pass to the backend on the command line */
snprintf(ExtraOptions + strlen(ExtraOptions),
sizeof(ExtraOptions) - strlen(ExtraOptions),
" %s", optarg);
break;
+
+ case 'P':
+ SetConfigOption("ignore_system_indexes", "true", PGC_POSTMASTER, PGC_S_ARGV);
+ break;
+
case 'p':
SetConfigOption("port", optarg, PGC_POSTMASTER, PGC_S_ARGV);
break;
- case 'S':
- /*
- * Start in 'S'ilent mode (disassociate from controlling tty).
- * You may also think of this as 'S'ysV mode since it's most
- * badly needed on SysV-derived systems like SVR4 and HP-UX.
- */
- SetConfigOption("silent_mode", "true", PGC_POSTMASTER, PGC_S_ARGV);
+ case 'r':
+ /* only used by single-user backend */
+ break;
+
+ case 'S':
+ SetConfigOption("work_mem", optarg, PGC_POSTMASTER, PGC_S_ARGV);
break;
+
case 's':
+ SetConfigOption("log_statement_stats", optarg, PGC_POSTMASTER, PGC_S_ARGV);
+ break;
+ case 'T':
/*
* In the event that some backend dumps core, send SIGSTOP,
* rather than SIGQUIT, to all its peers. This lets the wily
@@ -538,6 +554,28 @@ PostmasterMain(int argc, char *argv[])
*/
SendStop = true;
break;
+
+ case 't':
+ {
+ const char *tmp = get_stats_option_name(optarg);
+
+ if (tmp)
+ {
+ SetConfigOption(tmp, "true", PGC_POSTMASTER, PGC_S_ARGV);
+ }
+ else
+ {
+ write_stderr("%s: invalid argument for option -t: \"%s\"\n",
+ progname, optarg);
+ ExitPostmaster(1);
+ }
+ break;
+ }
+
+ case 'W':
+ SetConfigOption("post_auth_delay", optarg, PGC_POSTMASTER, PGC_S_ARGV);
+ break;
+
case 'c':
case '-':
{
@@ -1113,6 +1151,7 @@ usage(const char *progname)
printf(_(" -c NAME=VALUE set run-time parameter\n"));
printf(_(" -d 1-5 debugging level\n"));
printf(_(" -D DATADIR database directory\n"));
+ printf(_(" -e use European date input format (DMY)\n"));
printf(_(" -F turn fsync off\n"));
printf(_(" -h HOSTNAME host name or IP address to listen on\n"));
printf(_(" -i enable TCP/IP connections\n"));
@@ -1121,18 +1160,25 @@ usage(const char *progname)
printf(_(" -l enable SSL connections\n"));
#endif
printf(_(" -N MAX-CONNECT maximum number of allowed connections\n"));
- printf(_(" -o OPTIONS pass \"OPTIONS\" to each server process\n"));
+ printf(_(" -o OPTIONS pass \"OPTIONS\" to each server process (obsolete)\n"));
printf(_(" -p PORT port number to listen on\n"));
- printf(_(" -S silent mode (start in background without logging output)\n"));
+ printf(_(" -s show statistics after each query\n"));
+ printf(_(" -S WORK-MEM set amount of memory for sorts (in kB)\n"));
+ printf(_(" --NAME=VALUE set run-time parameter\n"));
printf(_(" --help show this help, then exit\n"));
printf(_(" --version output version information, then exit\n"));
printf(_("\nDeveloper options:\n"));
+ printf(_(" -f s|i|n|m|h forbid use of some plan types\n"));
printf(_(" -n do not reinitialize shared memory after abnormal exit\n"));
- printf(_(" -s send SIGSTOP to all backend servers if one dies\n"));
+ printf(_(" -O allow system table structure changes\n"));
+ printf(_(" -P disable system indexes\n"));
+ printf(_(" -t pa|pl|ex show timings after each query\n"));
+ printf(_(" -T send SIGSTOP to all backend servers if one dies\n"));
+ printf(_(" -W NUM wait NUM seconds to allow attach from a debugger\n"));
printf(_("\nPlease read the documentation for the complete list of run-time\n"
- "configuration settings and how to set them on the command line or in\n"
+ "configuration settings and how to set them on the command line or in\n"
"the configuration file.\n\n"
"Report bugs to <pgsql-bugs@postgresql.org>.\n"));
}
@@ -2797,8 +2843,8 @@ BackendRun(Port *port)
* Now, build the argv vector that will be given to PostgresMain.
*
* The layout of the command line is
- * postgres [secure switches] -p databasename [insecure switches]
- * where the switches after -p come from the client request.
+ * postgres [secure switches] -y databasename [insecure switches]
+ * where the switches after -y come from the client request.
*
* The maximum possible number of commandline arguments that could come
* from ExtraOptions or port->cmdline_options is (strlen + 1) / 2; see
@@ -2829,9 +2875,9 @@ BackendRun(Port *port)
/*
* Tell the backend it is being called from the postmaster, and which
- * database to use. -p marks the end of secure switches.
+ * database to use. -y marks the end of secure switches.
*/
- av[ac++] = "-p";
+ av[ac++] = "-y";
av[ac++] = port->database_name;
/*
@@ -3575,7 +3621,7 @@ StartChildProcess(int xlop)
snprintf(xlbuf, sizeof(xlbuf), "-x%d", xlop);
av[ac++] = xlbuf;
- av[ac++] = "-p";
+ av[ac++] = "-y";
av[ac++] = "template1";
av[ac] = NULL;
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 8f28ce6d020..e38e66a38cb 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.476 2006/01/05 03:01:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.477 2006/01/05 10:07:45 petere Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -84,6 +84,10 @@ LogStmtLevel log_statement = LOGSTMT_NONE;
/* GUC variable for maximum stack depth (measured in kilobytes) */
int max_stack_depth = 2048;
+/* wait N seconds to allow attach from a debugger */
+int PostAuthDelay = 0;
+
+
/* ----------------
* private variables
@@ -2338,30 +2342,30 @@ usage(const char *progname)
{
printf(_("%s is the PostgreSQL stand-alone backend. It is not\nintended to be used by normal users.\n\n"), progname);
- printf(_("Usage:\n %s [OPTION]... [DBNAME]\n\n"), progname);
+ printf(_("Usage:\n %s [OPTION]... DBNAME\n\n"), progname);
printf(_("Options:\n"));
#ifdef USE_ASSERT_CHECKING
printf(_(" -A 1|0 enable/disable run-time assert checking\n"));
#endif
printf(_(" -B NBUFFERS number of shared buffers\n"));
printf(_(" -c NAME=VALUE set run-time parameter\n"));
- printf(_(" -d 0-5 debugging level (0 is off)\n"));
+ printf(_(" -d 0-5 debugging level\n"));
printf(_(" -D DATADIR database directory\n"));
printf(_(" -e use European date input format (DMY)\n"));
- printf(_(" -E echo query before execution\n"));
+ printf(_(" -E echo statement before execution\n"));
printf(_(" -F turn fsync off\n"));
- printf(_(" -N do not use newline as interactive query delimiter\n"));
- printf(_(" -o FILENAME send stdout and stderr to given file\n"));
- printf(_(" -P disable system indexes\n"));
+ printf(_(" -j do not use newline as interactive query delimiter\n"));
+ printf(_(" -r FILENAME send stdout and stderr to given file\n"));
printf(_(" -s show statistics after each query\n"));
printf(_(" -S WORK-MEM set amount of memory for sorts (in kB)\n"));
+ printf(_(" --NAME=VALUE set run-time parameter\n"));
printf(_(" --describe-config describe configuration parameters, then exit\n"));
printf(_(" --help show this help, then exit\n"));
printf(_(" --version output version information, then exit\n"));
printf(_("\nDeveloper options:\n"));
printf(_(" -f s|i|n|m|h forbid use of some plan types\n"));
- printf(_(" -i do not execute queries\n"));
printf(_(" -O allow system table structure changes\n"));
+ printf(_(" -P disable system indexes\n"));
printf(_(" -t pa|pl|ex show timings after each query\n"));
printf(_(" -W NUM wait NUM seconds to allow attach from a debugger\n"));
printf(_("\nReport bugs to <pgsql-bugs@postgresql.org>.\n"));
@@ -2403,6 +2407,66 @@ set_debug_options(int debug_flag, GucContext context, GucSource source)
}
+bool
+set_plan_disabling_options(const char *arg, GucContext context, GucSource source)
+{
+ char *tmp = NULL;
+
+ switch (arg[0])
+ {
+ case 's': /* seqscan */
+ tmp = "enable_seqscan";
+ break;
+ case 'i': /* indexscan */
+ tmp = "enable_indexscan";
+ break;
+ case 'b': /* bitmapscan */
+ tmp = "enable_bitmapscan";
+ break;
+ case 't': /* tidscan */
+ tmp = "enable_tidscan";
+ break;
+ case 'n': /* nestloop */
+ tmp = "enable_nestloop";
+ break;
+ case 'm': /* mergejoin */
+ tmp = "enable_mergejoin";
+ break;
+ case 'h': /* hashjoin */
+ tmp = "enable_hashjoin";
+ break;
+ }
+ if (tmp)
+ {
+ SetConfigOption(tmp, "false", context, source);
+ return true;
+ }
+ else
+ return false;
+}
+
+
+const char *
+get_stats_option_name(const char *arg)
+{
+ switch (arg[0])
+ {
+ case 'p':
+ if (optarg[1] == 'a') /* "parser" */
+ return "log_parser_stats";
+ else if (optarg[1] == 'l') /* "planner" */
+ return "log_planner_stats";
+ break;
+
+ case 'e': /* "executor" */
+ return "log_executor_stats";
+ break;
+ }
+
+ return NULL;
+}
+
+
/* ----------------------------------------------------------------
* PostgresMain
* postgres main loop -- all backends, interactive or otherwise start here
@@ -2427,7 +2491,6 @@ PostgresMain(int argc, char *argv[], const char *username)
GucContext ctx;
GucSource gucsource;
bool am_superuser;
- char *tmp;
int firstchar;
char stack_base;
StringInfoData input_message;
@@ -2518,164 +2581,100 @@ PostgresMain(int argc, char *argv[], const char *username)
ctx = PGC_POSTMASTER;
gucsource = PGC_S_ARGV; /* initial switches came from command line */
- while ((flag = getopt(argc, argv, "A:B:c:D:d:Eef:FiNOPo:p:S:st:v:W:-:")) != -1)
+ while ((flag = getopt(argc, argv, "A:B:c:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:y:-:")) != -1)
{
switch (flag)
{
case 'A':
-#ifdef USE_ASSERT_CHECKING
SetConfigOption("debug_assertions", optarg, ctx, gucsource);
-#else
- ereport(WARNING,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("assert checking is not compiled in")));
-#endif
break;
case 'B':
-
- /*
- * specify the size of buffer pool
- */
SetConfigOption("shared_buffers", optarg, ctx, gucsource);
break;
- case 'D': /* PGDATA or config directory */
+ case 'D':
if (secure)
userDoption = optarg;
break;
- case 'd': /* debug level */
+ case 'd':
debug_flag = atoi(optarg);
break;
case 'E':
-
- /*
- * E - echo the query the user entered
- */
EchoQuery = true;
break;
case 'e':
-
- /*
- * Use European date input format (DMY)
- */
SetConfigOption("datestyle", "euro", ctx, gucsource);
break;
case 'F':
-
- /*
- * turn off fsync
- */
SetConfigOption("fsync", "false", ctx, gucsource);
break;
case 'f':
+ if (!set_plan_disabling_options(optarg, ctx, gucsource))
+ errs++;
+ break;
- /*
- * f - forbid generation of certain plans
- */
- tmp = NULL;
- switch (optarg[0])
- {
- case 's': /* seqscan */
- tmp = "enable_seqscan";
- break;
- case 'i': /* indexscan */
- tmp = "enable_indexscan";
- break;
- case 'b': /* bitmapscan */
- tmp = "enable_bitmapscan";
- break;
- case 't': /* tidscan */
- tmp = "enable_tidscan";
- break;
- case 'n': /* nestloop */
- tmp = "enable_nestloop";
- break;
- case 'm': /* mergejoin */
- tmp = "enable_mergejoin";
- break;
- case 'h': /* hashjoin */
- tmp = "enable_hashjoin";
- break;
- default:
- errs++;
- }
- if (tmp)
- SetConfigOption(tmp, "false", ctx, gucsource);
+ case 'h':
+ SetConfigOption("listen_addresses", optarg, ctx, gucsource);
break;
- case 'N':
+ case 'i':
+ SetConfigOption("listen_addresses", "*", ctx, gucsource);
+ break;
- /*
- * N - Don't use newline as a query delimiter
- */
+ case 'j':
UseNewLine = 0;
break;
- case 'O':
+ case 'k':
+ SetConfigOption("unix_socket_directory", optarg, ctx, gucsource);
+ break;
- /*
- * allow system table structure modifications
- */
- if (secure) /* XXX safe to allow from client??? */
- allowSystemTableMods = true;
+ case 'l':
+ SetConfigOption("ssl", "true", ctx, gucsource);
break;
- case 'P':
+ case 'N':
+ SetConfigOption("max_connections", optarg, ctx, gucsource);
+ break;
- /*
- * ignore system indexes
- *
- * As of PG 7.4 this is safe to allow from the client, since
- * it only disables reading the system indexes, not writing
- * them. Worst case consequence is slowness.
- */
- IgnoreSystemIndexes(true);
+ case 'n':
+ /* ignored for consistency with postmaster */
+ break;
+
+ case 'O':
+ SetConfigOption("allow_system_table_mods", "true", ctx, gucsource);
break;
case 'o':
+ errs++;
+ break;
- /*
- * o - send output (stdout and stderr) to the given file
- */
- if (secure)
- StrNCpy(OutputFileName, optarg, MAXPGPATH);
+ case 'P':
+ SetConfigOption("ignore_system_indexes", "true", ctx, gucsource);
break;
case 'p':
+ SetConfigOption("port", optarg, ctx, gucsource);
+ break;
- /*
- * p - special flag passed if backend was forked by a
- * postmaster.
- */
+ case 'r':
+ /* send output (stdout and stderr) to the given file */
if (secure)
- {
- dbname = strdup(optarg);
-
- secure = false; /* subsequent switches are NOT secure */
- ctx = PGC_BACKEND;
- gucsource = PGC_S_CLIENT;
- }
+ StrNCpy(OutputFileName, optarg, MAXPGPATH);
break;
case 'S':
-
- /*
- * S - amount of sort memory to use in 1k bytes
- */
SetConfigOption("work_mem", optarg, ctx, gucsource);
break;
case 's':
-
/*
- * s - report usage statistics (timings) after each query
- *
* Since log options are SUSET, we need to postpone unless
* still in secure context
*/
@@ -2686,35 +2685,13 @@ PostgresMain(int argc, char *argv[], const char *username)
ctx, gucsource);
break;
+ case 'T':
+ /* ignored for consistency with postmaster */
+ break;
+
case 't':
- /* ---------------
- * tell postgres to report usage statistics (timings) for
- * each query
- *
- * -tpa[rser] = print stats for parser time of each query
- * -tpl[anner] = print stats for planner time of each query
- * -te[xecutor] = print stats for executor time of each query
- * caution: -s can not be used together with -t.
- * ----------------
- */
- tmp = NULL;
- switch (optarg[0])
- {
- case 'p':
- if (optarg[1] == 'a')
- tmp = "log_parser_stats";
- else if (optarg[1] == 'l')
- tmp = "log_planner_stats";
- else
- errs++;
- break;
- case 'e':
- tmp = "log_executor_stats";
- break;
- default:
- errs++;
- break;
- }
+ {
+ const char *tmp = get_stats_option_name(optarg);
if (tmp)
{
if (ctx == PGC_BACKEND)
@@ -2722,7 +2699,10 @@ PostgresMain(int argc, char *argv[], const char *username)
else
SetConfigOption(tmp, "true", ctx, gucsource);
}
+ else
+ errs++;
break;
+ }
case 'v':
if (secure)
@@ -2730,11 +2710,23 @@ PostgresMain(int argc, char *argv[], const char *username)
break;
case 'W':
+ SetConfigOption("post_auth_delay", optarg, ctx, gucsource);
+ break;
+
+ case 'y':
/*
- * wait N seconds to allow attach from a debugger
+ * y - special flag passed if backend was forked by a
+ * postmaster.
*/
- pg_usleep(atoi(optarg) * 1000000L);
+ if (secure)
+ {
+ dbname = strdup(optarg);
+
+ secure = false; /* subsequent switches are NOT secure */
+ ctx = PGC_BACKEND;
+ gucsource = PGC_S_CLIENT;
+ }
break;
case 'c':
@@ -2813,6 +2805,9 @@ PostgresMain(int argc, char *argv[], const char *username)
pg_timezone_initialize();
}
+ if (PostAuthDelay)
+ pg_usleep(PostAuthDelay * 1000000L);
+
/*
* Set up signal handlers and masks.
*
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 9854291df8c..216f1c85292 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.233 2005/12/09 01:22:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.234 2006/01/05 10:07:46 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -551,7 +551,7 @@ RelationBuildRuleLock(Relation relation)
*
* Note: since we scan the rules using RewriteRelRulenameIndexId, we will
* be reading the rules in name order, except possibly during
- * emergency-recovery operations (ie, IsIgnoringSystemIndexes). This in
+ * emergency-recovery operations (ie, IgnoreSystemIndexes). This in
* turn ensures that rules will be fired in name order.
*/
rewrite_desc = heap_open(RewriteRelationId, AccessShareLock);
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 5dd8a620643..f75d013a810 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.152 2006/01/05 03:01:36 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.153 2006/01/05 10:07:46 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,27 +62,7 @@ static char socketLockFile[MAXPGPATH];
* ----------------------------------------------------------------
*/
-static bool isIgnoringSystemIndexes = false;
-
-/*
- * IsIgnoringSystemIndexes
- * True if ignoring system indexes.
- */
-bool
-IsIgnoringSystemIndexes(void)
-{
- return isIgnoringSystemIndexes;
-}
-
-/*
- * IgnoreSystemIndexes
- * Set true or false whether PostgreSQL ignores system indexes.
- */
-void
-IgnoreSystemIndexes(bool mode)
-{
- isIgnoringSystemIndexes = mode;
-}
+bool IgnoreSystemIndexes = false;
/* ----------------------------------------------------------------
* system index reindexing support
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 124d2609b35..ffd49da69ef 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.305 2005/12/30 00:13:50 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.306 2006/01/05 10:07:46 petere Exp $
*
*--------------------------------------------------------------------
*/
@@ -130,6 +130,7 @@ static const char *show_num_temp_buffers(void);
static bool assign_phony_autocommit(bool newval, bool doit, GucSource source);
static const char *assign_custom_variable_classes(const char *newval, bool doit,
GucSource source);
+static bool assign_debug_assertions(bool newval, bool doit, GucSource source);
static bool assign_ssl(bool newval, bool doit, GucSource source);
static bool assign_stage_log_stats(bool newval, bool doit, GucSource source);
static bool assign_log_stats(bool newval, bool doit, GucSource source);
@@ -316,7 +317,7 @@ const char *const config_group_names[] =
/* STATS_COLLECTOR */
gettext_noop("Statistics / Query and Index Statistics Collector"),
/* AUTOVACUUM */
- gettext_noop("Auto Vacuum"),
+ gettext_noop("Autovacuum"),
/* CLIENT_CONN */
gettext_noop("Client Connection Defaults"),
/* CLIENT_CONN_STATEMENT */
@@ -560,8 +561,6 @@ static struct config_bool ConfigureNamesBool[] =
&Log_disconnections,
false, NULL, NULL
},
-
-#ifdef USE_ASSERT_CHECKING
{
{"debug_assertions", PGC_USERSET, DEVELOPER_OPTIONS,
gettext_noop("Turns on various assertion checks."),
@@ -569,10 +568,13 @@ static struct config_bool ConfigureNamesBool[] =
GUC_NOT_IN_SAMPLE
},
&assert_enabled,
- true, NULL, NULL
- },
+#ifdef USE_ASSERT_CHECKING
+ true,
+#else
+ false,
#endif
-
+ assign_debug_assertions, NULL
+ },
{
/* currently undocumented, so don't show in SHOW ALL */
{"exit_on_error", PGC_USERSET, UNGROUPED,
@@ -978,6 +980,27 @@ static struct config_bool ConfigureNamesBool[] =
false, NULL, NULL
},
+ {
+ {"allow_system_table_mods", PGC_BACKEND, DEVELOPER_OPTIONS,
+ gettext_noop("Allows modifications of the structure of system tables."),
+ NULL,
+ GUC_NOT_IN_SAMPLE
+ },
+ &allowSystemTableMods,
+ false, NULL, NULL
+ },
+
+ {
+ {"ignore_system_indexes", PGC_BACKEND, DEVELOPER_OPTIONS,
+ gettext_noop("Disabled reading from system indexes."),
+ gettext_noop("It does not prevent updating the indexes, so it is safe "
+ "to use. The worst consequence is slowness."),
+ GUC_NOT_IN_SAMPLE
+ },
+ &IgnoreSystemIndexes,
+ false, NULL, NULL
+ },
+
/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL
@@ -988,6 +1011,15 @@ static struct config_bool ConfigureNamesBool[] =
static struct config_int ConfigureNamesInt[] =
{
{
+ {"post_auth_delay", PGC_BACKEND, DEVELOPER_OPTIONS,
+ gettext_noop("Waits N seconds on connection startup after authentication."),
+ gettext_noop("This allows attaching a debugger to the process."),
+ GUC_NOT_IN_SAMPLE
+ },
+ &PostAuthDelay,
+ 0, 0, INT_MAX, NULL, NULL
+ },
+ {
{"default_statistics_target", PGC_USERSET, QUERY_TUNING_OTHER,
gettext_noop("Sets the default statistics target."),
gettext_noop("This applies to table columns that have not had a "
@@ -5866,6 +5898,18 @@ assign_custom_variable_classes(const char *newval, bool doit, GucSource source)
}
static bool
+assign_debug_assertions(bool newval, bool doit, GucSource source)
+{
+#ifndef USE_ASSERT_CHECKING
+ if (newval)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("assertion checking is not supported by this build")));
+#endif
+ return true;
+}
+
+static bool
assign_ssl(bool newval, bool doit, GucSource source)
{
#ifndef USE_SSL
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 8aecb08a2c0..367b3083e0d 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.105 2006/01/05 03:01:36 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.106 2006/01/05 10:07:46 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1686,10 +1686,10 @@ setup_sysviews(void)
sysviews_setup = readfile(system_views_file);
/*
- * We use -N here to avoid backslashing stuff in system_views.sql
+ * We use -j here to avoid backslashing stuff in system_views.sql
*/
snprintf(cmd, sizeof(cmd),
- "\"%s\" %s -N template1 >%s",
+ "\"%s\" %s -j template1 >%s",
backend_exec, backend_options,
DEVNULL);
@@ -1870,10 +1870,10 @@ setup_schema(void)
lines = readfile(info_schema_file);
/*
- * We use -N here to avoid backslashing stuff in information_schema.sql
+ * We use -j here to avoid backslashing stuff in information_schema.sql
*/
snprintf(cmd, sizeof(cmd),
- "\"%s\" %s -N template1 >%s",
+ "\"%s\" %s -j template1 >%s",
backend_exec, backend_options,
DEVNULL);
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index e354b816c2d..ce56c22d434 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.184 2005/11/22 18:17:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.185 2006/01/05 10:07:46 petere Exp $
*
* NOTES
* some of the information in this file should be moved to other files.
@@ -306,8 +306,7 @@ extern bool InitPostgres(const char *dbname, const char *username);
extern void BaseInit(void);
/* in utils/init/miscinit.c */
-extern void IgnoreSystemIndexes(bool mode);
-extern bool IsIgnoringSystemIndexes(void);
+extern bool IgnoreSystemIndexes;
extern void SetReindexProcessing(Oid heapOid, Oid indexOid);
extern void ResetReindexProcessing(void);
extern bool ReindexIsProcessingHeap(Oid heapOid);
diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
index 1f03f546c8e..ebcfec26904 100644
--- a/src/include/tcop/tcopprot.h
+++ b/src/include/tcop/tcopprot.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.78 2005/10/15 02:49:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.79 2006/01/05 10:07:46 petere Exp $
*
* OLD COMMENTS
* This file was created so that other c files could get the two
@@ -28,6 +28,7 @@
extern CommandDest whereToSendOutput;
extern DLLIMPORT const char *debug_query_string;
extern int max_stack_depth;
+extern int PostAuthDelay;
/* GUC-configurable parameters */
@@ -67,5 +68,8 @@ extern void ResetUsage(void);
extern void ShowUsage(const char *title);
extern void set_debug_options(int debug_flag,
GucContext context, GucSource source);
+extern bool set_plan_disabling_options(const char *arg,
+ GucContext context, GucSource source);
+extern const char *get_stats_option_name(const char *arg);
#endif /* TCOPPROT_H */