aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/bootstrap/bootstrap.c3
-rw-r--r--src/backend/commands/variable.c37
-rw-r--r--src/backend/utils/init/globals.c3
-rw-r--r--src/backend/utils/misc/trace.c11
-rw-r--r--src/bin/psql/psqlHelp.h7
-rw-r--r--src/include/miscadmin.h6
-rw-r--r--src/include/utils/trace.h2
7 files changed, 59 insertions, 10 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 18d9567ab89..c20a63fc6dc 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.67 1999/09/18 19:06:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.68 1999/09/27 20:26:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -134,7 +134,6 @@ static char *relname; /* current relation name */
Form_pg_attribute attrtypes[MAXATTR]; /* points to attribute info */
static char *values[MAXATTR]; /* cooresponding attribute values */
int numattr; /* number of attributes for cur. rel */
-extern bool disableFsync; /* do not fsync the database */
int DebugMode;
static GlobalMemory nogc = (GlobalMemory) NULL; /* special no-gc mem
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index d34b97c90df..ffbe98b97ff 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO',
* 'SHOW var' and 'RESET var' statements.
*
- * $Id: variable.c,v 1.25 1999/07/17 20:16:54 momjian Exp $
+ * $Id: variable.c,v 1.26 1999/09/27 20:27:03 momjian Exp $
*
*/
@@ -11,11 +11,13 @@
#include "postgres.h"
#include "access/xact.h"
+#include "catalog/pg_shadow.h"
#include "commands/variable.h"
#include "miscadmin.h"
#include "optimizer/internal.h"
#include "utils/builtins.h"
#include "utils/tqual.h"
+#include "utils/trace.h"
#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
@@ -528,6 +530,36 @@ reset_timezone()
return TRUE;
} /* reset_timezone() */
+/*
+ * Pg_options
+ */
+static bool
+parse_pg_options(const char *value)
+{
+ if (!superuser()) {
+ elog(ERROR, "Only users with superuser privilege can set pg_options");
+ }
+ parse_options((char *) value, TRUE);
+ return (TRUE);
+}
+
+static bool
+show_pg_options(void)
+{
+ show_options();
+ return (TRUE);
+}
+
+static bool
+reset_pg_options(void)
+{
+ if (!superuser()) {
+ elog(ERROR, "Only users with superuser privilege can set pg_options");
+ }
+ read_pg_options(0);
+ return (TRUE);
+}
+
/*-----------------------------------------------------------------------*/
struct VariableParsers
@@ -569,6 +601,9 @@ struct VariableParsers
"XactIsoLevel", parse_XactIsoLevel, show_XactIsoLevel, reset_XactIsoLevel
},
{
+ "pg_options", parse_pg_options, show_pg_options, reset_pg_options
+ },
+ {
NULL, NULL, NULL, NULL
}
};
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 1cde72e6b2f..281db5a5416 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.36 1999/07/17 20:18:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.37 1999/09/27 20:27:09 momjian Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
@@ -76,7 +76,6 @@ char DateFormat[20] = "%d-%m-%Y"; /* mjl: sizes! or better
* malloc? XXX */
char FloatFormat[20] = "%f";
-bool disableFsync = false;
bool allowSystemTableMods = false;
int SortMem = 512;
diff --git a/src/backend/utils/misc/trace.c b/src/backend/utils/misc/trace.c
index 3d9cbe607de..2a1fe5ab8d6 100644
--- a/src/backend/utils/misc/trace.c
+++ b/src/backend/utils/misc/trace.c
@@ -73,6 +73,7 @@ static char *opt_names[] = {
"lock_debug_relid",
"lock_read_priority", /* lock priority, see lock.c */
"deadlock_timeout", /* deadlock timeout, see proc.c */
+ "nofsync", /* turn fsync off */
"syslog", /* use syslog for error messages */
"hostlookup", /* enable hostname lookup in ps_status */
"showportnumber", /* show port number in ps_status */
@@ -405,6 +406,16 @@ read_pg_options(SIGNAL_ARGS)
close(fd);
}
+void
+show_options(void)
+{
+ int i;
+
+ for (i=0; i<NUM_PG_OPTIONS; i++) {
+ elog(NOTICE, "%s=%d", opt_names[i], pg_options[i]);
+ }
+}
+
/*
* Local variables:
* tab-width: 4
diff --git a/src/bin/psql/psqlHelp.h b/src/bin/psql/psqlHelp.h
index f17995a2207..020d8e450e1 100644
--- a/src/bin/psql/psqlHelp.h
+++ b/src/bin/psql/psqlHelp.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: psqlHelp.h,v 1.74 1999/09/23 17:11:16 momjian Exp $
+ * $Id: psqlHelp.h,v 1.75 1999/09/27 20:27:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -296,7 +296,7 @@ static struct _helpStruct QL_HELP[] = {
{"reset",
"set run-time environment back to default",
"\
-\tRESET DATESTYLE|COST_HEAP|COST_INDEX|GEQO|KSQO|\n\
+\tRESET DATESTYLE|COST_HEAP|COST_INDEX|GEQO|KSQO|PG_OPTIONS|\n\
TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"},
{"revoke",
"revoke access control from a user or group",
@@ -329,6 +329,7 @@ TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"},
\tSET COST_INDEX TO #\n\
\tSET GEQO TO 'ON[=#]'|'OFF'\n\
\tSET KSQO TO 'ON'|'OFF'\n\
+\tSET PG_OPTIONS TO 'value'\n\
\tSET TIMEZONE TO 'value'\n\
\tSET TRANSACTION ISOLATION LEVEL 'SERIALIZABLE'|'READ COMMITTED'\n\
\tSET CLIENT_ENCODING|NAMES TO 'EUC_JP'|'SJIS'|'EUC_CN'|'EUC_KR'|'EUC_TW'|\n\
@@ -340,7 +341,7 @@ TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"},
{"show",
"show current run-time environment",
"\
-\tSHOW DATESTYLE|COST_HEAP|COST_INDEX|GEQO|KSQO|\n\
+\tSHOW DATESTYLE|COST_HEAP|COST_INDEX|GEQO|KSQO|PG_OPTIONS|\n\
TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"},
{"unlisten",
"stop listening for notification on a condition name",
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index ecd567c364f..12eb3f87bae 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -11,7 +11,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: miscadmin.h,v 1.41 1999/09/24 00:25:16 tgl Exp $
+ * $Id: miscadmin.h,v 1.42 1999/09/27 20:27:26 momjian Exp $
*
* NOTES
* some of the information in this file will be moved to
@@ -22,6 +22,8 @@
#ifndef MISCADMIN_H
#define MISCADMIN_H
+#include "utils/trace.h"
+
/*****************************************************************************
* globals.h -- *
*****************************************************************************/
@@ -93,7 +95,7 @@ extern char CTZName[];
extern char FloatFormat[];
extern char DateFormat[];
-extern bool disableFsync;
+#define disableFsync pg_options[OPT_NOFSYNC]
extern bool allowSystemTableMods;
extern int SortMem;
diff --git a/src/include/utils/trace.h b/src/include/utils/trace.h
index 4bcdee3ae57..3cb2d9e28f1 100644
--- a/src/include/utils/trace.h
+++ b/src/include/utils/trace.h
@@ -26,6 +26,7 @@ char *tprintf_timestamp(void);
extern int tprintf(int flag, const char *fmt,...);
extern int eprintf(const char *fmt,...);
extern void write_syslog(int level, char *line);
+extern void show_options(void);
extern void parse_options(char *str, bool secure);
extern void read_pg_options(SIGNAL_ARGS);
@@ -57,6 +58,7 @@ enum pg_option_enum {
TRACE_LOCKRELATION,
OPT_LOCKREADPRIORITY, /* lock priority, see lock.c */
OPT_DEADLOCKTIMEOUT, /* deadlock timeout, see proc.c */
+ OPT_NOFSYNC, /* turn fsync off */
OPT_SYSLOG, /* use syslog for error messages */
OPT_HOSTLOOKUP, /* enable hostname lookup in ps_status */
OPT_SHOWPORTNUMBER, /* show port number in ps_status */