Skip to content

Commit d62a7ac

Browse files
committed
Massimo's SET FSYNC and SHOW PG_OPTIONS changes, without SET QUERY_LIMIT.
1 parent 5a017b9 commit d62a7ac

File tree

8 files changed

+59
-129
lines changed

8 files changed

+59
-129
lines changed

doc/TODO.detail/nulls

Lines changed: 0 additions & 119 deletions
This file was deleted.

src/backend/bootstrap/bootstrap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.67 1999/09/18 19:06:27 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.68 1999/09/27 20:26:58 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -134,7 +134,6 @@ static char *relname; /* current relation name */
134134
Form_pg_attribute attrtypes[MAXATTR]; /* points to attribute info */
135135
static char *values[MAXATTR]; /* cooresponding attribute values */
136136
int numattr; /* number of attributes for cur. rel */
137-
extern bool disableFsync; /* do not fsync the database */
138137

139138
int DebugMode;
140139
static GlobalMemory nogc = (GlobalMemory) NULL; /* special no-gc mem

src/backend/commands/variable.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Routines for handling of 'SET var TO',
33
* 'SHOW var' and 'RESET var' statements.
44
*
5-
* $Id: variable.c,v 1.25 1999/07/17 20:16:54 momjian Exp $
5+
* $Id: variable.c,v 1.26 1999/09/27 20:27:03 momjian Exp $
66
*
77
*/
88

@@ -11,11 +11,13 @@
1111

1212
#include "postgres.h"
1313
#include "access/xact.h"
14+
#include "catalog/pg_shadow.h"
1415
#include "commands/variable.h"
1516
#include "miscadmin.h"
1617
#include "optimizer/internal.h"
1718
#include "utils/builtins.h"
1819
#include "utils/tqual.h"
20+
#include "utils/trace.h"
1921

2022
#ifdef MULTIBYTE
2123
#include "mb/pg_wchar.h"
@@ -528,6 +530,36 @@ reset_timezone()
528530
return TRUE;
529531
} /* reset_timezone() */
530532

533+
/*
534+
* Pg_options
535+
*/
536+
static bool
537+
parse_pg_options(const char *value)
538+
{
539+
if (!superuser()) {
540+
elog(ERROR, "Only users with superuser privilege can set pg_options");
541+
}
542+
parse_options((char *) value, TRUE);
543+
return (TRUE);
544+
}
545+
546+
static bool
547+
show_pg_options(void)
548+
{
549+
show_options();
550+
return (TRUE);
551+
}
552+
553+
static bool
554+
reset_pg_options(void)
555+
{
556+
if (!superuser()) {
557+
elog(ERROR, "Only users with superuser privilege can set pg_options");
558+
}
559+
read_pg_options(0);
560+
return (TRUE);
561+
}
562+
531563
/*-----------------------------------------------------------------------*/
532564

533565
struct VariableParsers
@@ -568,6 +600,9 @@ struct VariableParsers
568600
{
569601
"XactIsoLevel", parse_XactIsoLevel, show_XactIsoLevel, reset_XactIsoLevel
570602
},
603+
{
604+
"pg_options", parse_pg_options, show_pg_options, reset_pg_options
605+
},
571606
{
572607
NULL, NULL, NULL, NULL
573608
}

src/backend/utils/init/globals.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.36 1999/07/17 20:18:08 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.37 1999/09/27 20:27:09 momjian Exp $
1111
*
1212
* NOTES
1313
* 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
7676
* malloc? XXX */
7777
char FloatFormat[20] = "%f";
7878

79-
bool disableFsync = false;
8079
bool allowSystemTableMods = false;
8180
int SortMem = 512;
8281

src/backend/utils/misc/trace.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ static char *opt_names[] = {
7373
"lock_debug_relid",
7474
"lock_read_priority", /* lock priority, see lock.c */
7575
"deadlock_timeout", /* deadlock timeout, see proc.c */
76+
"nofsync", /* turn fsync off */
7677
"syslog", /* use syslog for error messages */
7778
"hostlookup", /* enable hostname lookup in ps_status */
7879
"showportnumber", /* show port number in ps_status */
@@ -405,6 +406,16 @@ read_pg_options(SIGNAL_ARGS)
405406
close(fd);
406407
}
407408

409+
void
410+
show_options(void)
411+
{
412+
int i;
413+
414+
for (i=0; i<NUM_PG_OPTIONS; i++) {
415+
elog(NOTICE, "%s=%d", opt_names[i], pg_options[i]);
416+
}
417+
}
418+
408419
/*
409420
* Local variables:
410421
* tab-width: 4

src/bin/psql/psqlHelp.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: psqlHelp.h,v 1.74 1999/09/23 17:11:16 momjian Exp $
8+
* $Id: psqlHelp.h,v 1.75 1999/09/27 20:27:20 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -296,7 +296,7 @@ static struct _helpStruct QL_HELP[] = {
296296
{"reset",
297297
"set run-time environment back to default",
298298
"\
299-
\tRESET DATESTYLE|COST_HEAP|COST_INDEX|GEQO|KSQO|\n\
299+
\tRESET DATESTYLE|COST_HEAP|COST_INDEX|GEQO|KSQO|PG_OPTIONS|\n\
300300
TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"},
301301
{"revoke",
302302
"revoke access control from a user or group",
@@ -329,6 +329,7 @@ TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"},
329329
\tSET COST_INDEX TO #\n\
330330
\tSET GEQO TO 'ON[=#]'|'OFF'\n\
331331
\tSET KSQO TO 'ON'|'OFF'\n\
332+
\tSET PG_OPTIONS TO 'value'\n\
332333
\tSET TIMEZONE TO 'value'\n\
333334
\tSET TRANSACTION ISOLATION LEVEL 'SERIALIZABLE'|'READ COMMITTED'\n\
334335
\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"},
340341
{"show",
341342
"show current run-time environment",
342343
"\
343-
\tSHOW DATESTYLE|COST_HEAP|COST_INDEX|GEQO|KSQO|\n\
344+
\tSHOW DATESTYLE|COST_HEAP|COST_INDEX|GEQO|KSQO|PG_OPTIONS|\n\
344345
TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"},
345346
{"unlisten",
346347
"stop listening for notification on a condition name",

src/include/miscadmin.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $Id: miscadmin.h,v 1.41 1999/09/24 00:25:16 tgl Exp $
14+
* $Id: miscadmin.h,v 1.42 1999/09/27 20:27:26 momjian Exp $
1515
*
1616
* NOTES
1717
* some of the information in this file will be moved to
@@ -22,6 +22,8 @@
2222
#ifndef MISCADMIN_H
2323
#define MISCADMIN_H
2424

25+
#include "utils/trace.h"
26+
2527
/*****************************************************************************
2628
* globals.h -- *
2729
*****************************************************************************/
@@ -93,7 +95,7 @@ extern char CTZName[];
9395
extern char FloatFormat[];
9496
extern char DateFormat[];
9597

96-
extern bool disableFsync;
98+
#define disableFsync pg_options[OPT_NOFSYNC]
9799
extern bool allowSystemTableMods;
98100
extern int SortMem;
99101

src/include/utils/trace.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ char *tprintf_timestamp(void);
2626
extern int tprintf(int flag, const char *fmt,...);
2727
extern int eprintf(const char *fmt,...);
2828
extern void write_syslog(int level, char *line);
29+
extern void show_options(void);
2930
extern void parse_options(char *str, bool secure);
3031
extern void read_pg_options(SIGNAL_ARGS);
3132

@@ -57,6 +58,7 @@ enum pg_option_enum {
5758
TRACE_LOCKRELATION,
5859
OPT_LOCKREADPRIORITY, /* lock priority, see lock.c */
5960
OPT_DEADLOCKTIMEOUT, /* deadlock timeout, see proc.c */
61+
OPT_NOFSYNC, /* turn fsync off */
6062
OPT_SYSLOG, /* use syslog for error messages */
6163
OPT_HOSTLOOKUP, /* enable hostname lookup in ps_status */
6264
OPT_SHOWPORTNUMBER, /* show port number in ps_status */

0 commit comments

Comments
 (0)