Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
51f19558
Commit
51f19558
authored
Feb 23, 2002
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save source of GUC settings, allowing different sources to be processed in
any order without affecting results.
parent
ab786f62
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
201 additions
and
191 deletions
+201
-191
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+3
-3
src/backend/commands/variable.c
src/backend/commands/variable.c
+3
-3
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+34
-65
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+20
-17
src/backend/utils/misc/guc-file.l
src/backend/utils/misc/guc-file.l
+5
-3
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+116
-97
src/include/utils/guc.h
src/include/utils/guc.h
+20
-3
No files found.
src/backend/bootstrap/bootstrap.c
View file @
51f19558
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.12
0 2002/01/10 01:11:45 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.12
1 2002/02/23 01:31:34 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -262,7 +262,7 @@ BootstrapMain(int argc, char *argv[])
...
@@ -262,7 +262,7 @@ BootstrapMain(int argc, char *argv[])
* parsing */
* parsing */
break
;
break
;
case
'F'
:
case
'F'
:
SetConfigOption
(
"fsync"
,
"false"
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"fsync"
,
"false"
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
case
'o'
:
case
'o'
:
StrNCpy
(
OutputFileName
,
optarg
,
MAXPGPATH
);
StrNCpy
(
OutputFileName
,
optarg
,
MAXPGPATH
);
...
@@ -274,7 +274,7 @@ BootstrapMain(int argc, char *argv[])
...
@@ -274,7 +274,7 @@ BootstrapMain(int argc, char *argv[])
/* indicates fork from postmaster */
/* indicates fork from postmaster */
break
;
break
;
case
'B'
:
case
'B'
:
SetConfigOption
(
"shared_buffers"
,
optarg
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"shared_buffers"
,
optarg
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
default:
default:
usage
();
usage
();
...
...
src/backend/commands/variable.c
View file @
51f19558
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.5
7 2001/12/09 04:37:50 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.5
8 2002/02/23 01:31:35 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -780,7 +780,7 @@ SetPGVariable(const char *name, List *args)
...
@@ -780,7 +780,7 @@ SetPGVariable(const char *name, List *args)
if
(
strcasecmp
(
name
,
"session_authorization"
)
==
0
)
if
(
strcasecmp
(
name
,
"session_authorization"
)
==
0
)
SetSessionAuthorization
(
value
);
SetSessionAuthorization
(
value
);
else
else
SetConfigOption
(
name
,
value
,
superuser
()
?
PGC_SUSET
:
PGC_USERSET
,
false
);
SetConfigOption
(
name
,
value
,
superuser
()
?
PGC_SUSET
:
PGC_USERSET
,
PGC_S_SESSION
);
}
}
return
;
return
;
}
}
...
@@ -846,5 +846,5 @@ ResetPGVariable(const char *name)
...
@@ -846,5 +846,5 @@ ResetPGVariable(const char *name)
else
else
SetConfigOption
(
name
,
NULL
,
SetConfigOption
(
name
,
NULL
,
superuser
()
?
PGC_SUSET
:
PGC_USERSET
,
superuser
()
?
PGC_SUSET
:
PGC_USERSET
,
false
);
PGC_S_SESSION
);
}
}
src/backend/postmaster/postmaster.c
View file @
51f19558
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.26
6 2002/02/19 20:45:04 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.26
7 2002/02/23 01:31:35 petere
Exp $
*
*
* NOTES
* NOTES
*
*
...
@@ -396,6 +396,8 @@ PostmasterMain(int argc, char *argv[])
...
@@ -396,6 +396,8 @@ PostmasterMain(int argc, char *argv[])
ALLOCSET_DEFAULT_MAXSIZE
);
ALLOCSET_DEFAULT_MAXSIZE
);
MemoryContextSwitchTo
(
PostmasterContext
);
MemoryContextSwitchTo
(
PostmasterContext
);
IgnoreSystemIndexes
(
false
);
/*
/*
* Options setup
* Options setup
*/
*/
...
@@ -403,60 +405,12 @@ PostmasterMain(int argc, char *argv[])
...
@@ -403,60 +405,12 @@ PostmasterMain(int argc, char *argv[])
/* PGPORT environment variable, if set, overrides GUC setting */
/* PGPORT environment variable, if set, overrides GUC setting */
if
(
getenv
(
"PGPORT"
))
if
(
getenv
(
"PGPORT"
))
SetConfigOption
(
"port"
,
getenv
(
"PGPORT"
),
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"port"
,
getenv
(
"PGPORT"
),
PGC_POSTMASTER
,
PGC_S_ARGV
/*sortof*/
);
potential_DataDir
=
getenv
(
"PGDATA"
);
/* default value */
potential_DataDir
=
getenv
(
"PGDATA"
);
/* default value */
/*
* First we must scan for a -D argument to get the data dir. Then read
* the config file. Finally, scan all the other arguments. (Command
* line switches override config file.)
*
* Note: The two lists of options must be exactly the same, even though
* perhaps the first one would only have to be "D:" with opterr turned
* off. But some versions of getopt (notably GNU) are going to
* arbitrarily permute some "non-options" (according to the local
* world view) which will result in some switches being associated
* with the wrong argument. Death and destruction will occur.
*/
opterr
=
1
;
opterr
=
1
;
while
((
opt
=
getopt
(
argc
,
argv
,
"A:a:B:b:c:D:d:Fh:ik:lm:MN:no:p:Ss-:"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'D'
:
potential_DataDir
=
optarg
;
break
;
case
'?'
:
fprintf
(
stderr
,
gettext
(
"Try '%s --help' for more information.
\n
"
),
progname
);
ExitPostmaster
(
1
);
}
}
/*
* Postmaster accepts no non-option switch arguments.
*/
if
(
optind
<
argc
)
{
postmaster_error
(
"invalid argument -- %s"
,
argv
[
optind
]);
fprintf
(
stderr
,
gettext
(
"Try '%s --help' for more information.
\n
"
),
progname
);
ExitPostmaster
(
1
);
}
checkDataDir
(
potential_DataDir
);
/* issues error messages */
SetDataDir
(
potential_DataDir
);
ProcessConfigFile
(
PGC_POSTMASTER
);
IgnoreSystemIndexes
(
false
);
/* reset getopt(3) to rescan arguments */
optind
=
1
;
#ifdef HAVE_INT_OPTRESET
optreset
=
1
;
/* some systems need this too */
#endif
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:a:B:b:c:D:d:Fh:ik:lm:MN:no:p:Ss-:"
))
!=
-
1
)
{
{
...
@@ -464,7 +418,7 @@ PostmasterMain(int argc, char *argv[])
...
@@ -464,7 +418,7 @@ PostmasterMain(int argc, char *argv[])
{
{
case
'A'
:
case
'A'
:
#ifdef USE_ASSERT_CHECKING
#ifdef USE_ASSERT_CHECKING
SetConfigOption
(
"debug_assertions"
,
optarg
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"debug_assertions"
,
optarg
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
#else
#else
postmaster_error
(
"Assert checking is not compiled in."
);
postmaster_error
(
"Assert checking is not compiled in."
);
#endif
#endif
...
@@ -473,13 +427,13 @@ PostmasterMain(int argc, char *argv[])
...
@@ -473,13 +427,13 @@ PostmasterMain(int argc, char *argv[])
/* Can no longer set authentication method. */
/* Can no longer set authentication method. */
break
;
break
;
case
'B'
:
case
'B'
:
SetConfigOption
(
"shared_buffers"
,
optarg
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"shared_buffers"
,
optarg
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
case
'b'
:
case
'b'
:
/* Can no longer set the backend executable file to use. */
/* Can no longer set the backend executable file to use. */
break
;
break
;
case
'D'
:
case
'D'
:
/* already done above */
potential_DataDir
=
optarg
;
break
;
break
;
case
'd'
:
case
'd'
:
...
@@ -487,23 +441,23 @@ PostmasterMain(int argc, char *argv[])
...
@@ -487,23 +441,23 @@ PostmasterMain(int argc, char *argv[])
* Turn on debugging for the postmaster and the backend
* Turn on debugging for the postmaster and the backend
* servers descended from it.
* servers descended from it.
*/
*/
SetConfigOption
(
"debug_level"
,
optarg
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"debug_level"
,
optarg
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
case
'F'
:
case
'F'
:
SetConfigOption
(
"fsync"
,
"false"
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"fsync"
,
"false"
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
case
'h'
:
case
'h'
:
SetConfigOption
(
"virtual_host"
,
optarg
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"virtual_host"
,
optarg
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
case
'i'
:
case
'i'
:
SetConfigOption
(
"tcpip_socket"
,
"true"
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"tcpip_socket"
,
"true"
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
case
'k'
:
case
'k'
:
SetConfigOption
(
"unix_socket_directory"
,
optarg
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"unix_socket_directory"
,
optarg
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
#ifdef USE_SSL
#ifdef USE_SSL
case
'l'
:
case
'l'
:
SetConfigOption
(
"ssl"
,
"true"
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"ssl"
,
"true"
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
#endif
#endif
case
'm'
:
case
'm'
:
...
@@ -519,7 +473,7 @@ PostmasterMain(int argc, char *argv[])
...
@@ -519,7 +473,7 @@ PostmasterMain(int argc, char *argv[])
break
;
break
;
case
'N'
:
case
'N'
:
/* The max number of backends to start. */
/* The max number of backends to start. */
SetConfigOption
(
"max_connections"
,
optarg
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"max_connections"
,
optarg
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
case
'n'
:
case
'n'
:
/* Don't reinit shared mem after abnormal exit */
/* Don't reinit shared mem after abnormal exit */
...
@@ -536,7 +490,7 @@ PostmasterMain(int argc, char *argv[])
...
@@ -536,7 +490,7 @@ PostmasterMain(int argc, char *argv[])
strcpy
(
original_extraoptions
,
optarg
);
strcpy
(
original_extraoptions
,
optarg
);
break
;
break
;
case
'p'
:
case
'p'
:
SetConfigOption
(
"port"
,
optarg
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"port"
,
optarg
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
case
'S'
:
case
'S'
:
...
@@ -546,7 +500,7 @@ PostmasterMain(int argc, char *argv[])
...
@@ -546,7 +500,7 @@ PostmasterMain(int argc, char *argv[])
* it's most badly needed on SysV-derived systems like
* it's most badly needed on SysV-derived systems like
* SVR4 and HP-UX.
* SVR4 and HP-UX.
*/
*/
SetConfigOption
(
"silent_mode"
,
"true"
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
"silent_mode"
,
"true"
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
break
;
break
;
case
's'
:
case
's'
:
...
@@ -573,7 +527,7 @@ PostmasterMain(int argc, char *argv[])
...
@@ -573,7 +527,7 @@ PostmasterMain(int argc, char *argv[])
elog
(
ERROR
,
"-c %s requires argument"
,
optarg
);
elog
(
ERROR
,
"-c %s requires argument"
,
optarg
);
}
}
SetConfigOption
(
name
,
value
,
PGC_POSTMASTER
,
true
);
SetConfigOption
(
name
,
value
,
PGC_POSTMASTER
,
PGC_S_ARGV
);
free
(
name
);
free
(
name
);
if
(
value
)
if
(
value
)
free
(
value
);
free
(
value
);
...
@@ -581,12 +535,22 @@ PostmasterMain(int argc, char *argv[])
...
@@ -581,12 +535,22 @@ PostmasterMain(int argc, char *argv[])
}
}
default:
default:
/* shouldn't get here */
fprintf
(
stderr
,
gettext
(
"Try '%s --help' for more information.
\n
"
),
progname
);
fprintf
(
stderr
,
gettext
(
"Try '%s --help' for more information.
\n
"
),
progname
);
ExitPostmaster
(
1
);
ExitPostmaster
(
1
);
}
}
}
}
/*
* Postmaster accepts no non-option switch arguments.
*/
if
(
optind
<
argc
)
{
postmaster_error
(
"invalid argument -- %s"
,
argv
[
optind
]);
fprintf
(
stderr
,
gettext
(
"Try '%s --help' for more information.
\n
"
),
progname
);
ExitPostmaster
(
1
);
}
/*
/*
* Check for invalid combinations of switches
* Check for invalid combinations of switches
*/
*/
...
@@ -601,6 +565,11 @@ PostmasterMain(int argc, char *argv[])
...
@@ -601,6 +565,11 @@ PostmasterMain(int argc, char *argv[])
ExitPostmaster
(
1
);
ExitPostmaster
(
1
);
}
}
checkDataDir
(
potential_DataDir
);
/* issues error messages */
SetDataDir
(
potential_DataDir
);
ProcessConfigFile
(
PGC_POSTMASTER
);
/*
/*
* Now that we are done processing the postmaster arguments, reset
* Now that we are done processing the postmaster arguments, reset
* getopt(3) library so that it will work correctly in subprocesses.
* getopt(3) library so that it will work correctly in subprocesses.
...
...
src/backend/tcop/postgres.c
View file @
51f19558
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.24
6 2002/02/19 19:54:43 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.24
7 2002/02/23 01:31:36 petere
Exp $
*
*
* NOTES
* NOTES
* this is the "main" module of the postgres backend and
* this is the "main" module of the postgres backend and
...
@@ -1089,6 +1089,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1089,6 +1089,7 @@ PostgresMain(int argc, char *argv[], const char *username)
bool
secure
;
bool
secure
;
int
errs
=
0
;
int
errs
=
0
;
GucContext
ctx
;
GucContext
ctx
;
GucSource
gucsource
;
char
*
tmp
;
char
*
tmp
;
int
firstchar
;
int
firstchar
;
...
@@ -1164,13 +1165,14 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1164,13 +1165,14 @@ PostgresMain(int argc, char *argv[], const char *username)
/* all options are allowed until '-p' */
/* all options are allowed until '-p' */
secure
=
true
;
secure
=
true
;
ctx
=
PGC_POSTMASTER
;
ctx
=
PGC_POSTMASTER
;
gucsource
=
PGC_S_ARGV
;
/* initial switches came from command line */
while
((
flag
=
getopt
(
argc
,
argv
,
"A:B:c:CD:d:Eef:FiNOPo:p:S:st:v:W:x:-:"
))
!=
-
1
)
while
((
flag
=
getopt
(
argc
,
argv
,
"A:B:c:CD:d:Eef:FiNOPo:p:S:st:v:W:x:-:"
))
!=
-
1
)
switch
(
flag
)
switch
(
flag
)
{
{
case
'A'
:
case
'A'
:
#ifdef USE_ASSERT_CHECKING
#ifdef USE_ASSERT_CHECKING
SetConfigOption
(
"debug_assertions"
,
optarg
,
ctx
,
tru
e
);
SetConfigOption
(
"debug_assertions"
,
optarg
,
ctx
,
gucsourc
e
);
#else
#else
elog
(
NOTICE
,
"Assert checking is not compiled in"
);
elog
(
NOTICE
,
"Assert checking is not compiled in"
);
#endif
#endif
...
@@ -1181,7 +1183,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1181,7 +1183,7 @@ PostgresMain(int argc, char *argv[], const char *username)
/*
/*
* specify the size of buffer pool
* specify the size of buffer pool
*/
*/
SetConfigOption
(
"shared_buffers"
,
optarg
,
ctx
,
tru
e
);
SetConfigOption
(
"shared_buffers"
,
optarg
,
ctx
,
gucsourc
e
);
break
;
break
;
case
'C'
:
case
'C'
:
...
@@ -1198,17 +1200,17 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1198,17 +1200,17 @@ PostgresMain(int argc, char *argv[], const char *username)
break
;
break
;
case
'd'
:
/* debug level */
case
'd'
:
/* debug level */
SetConfigOption
(
"debug_level"
,
optarg
,
ctx
,
tru
e
);
SetConfigOption
(
"debug_level"
,
optarg
,
ctx
,
gucsourc
e
);
if
(
DebugLvl
>=
1
)
if
(
DebugLvl
>=
1
)
SetConfigOption
(
"log_connections"
,
"true"
,
ctx
,
tru
e
);
SetConfigOption
(
"log_connections"
,
"true"
,
ctx
,
gucsourc
e
);
if
(
DebugLvl
>=
2
)
if
(
DebugLvl
>=
2
)
SetConfigOption
(
"debug_print_query"
,
"true"
,
ctx
,
tru
e
);
SetConfigOption
(
"debug_print_query"
,
"true"
,
ctx
,
gucsourc
e
);
if
(
DebugLvl
>=
3
)
if
(
DebugLvl
>=
3
)
SetConfigOption
(
"debug_print_parse"
,
"true"
,
ctx
,
tru
e
);
SetConfigOption
(
"debug_print_parse"
,
"true"
,
ctx
,
gucsourc
e
);
if
(
DebugLvl
>=
4
)
if
(
DebugLvl
>=
4
)
SetConfigOption
(
"debug_print_plan"
,
"true"
,
ctx
,
tru
e
);
SetConfigOption
(
"debug_print_plan"
,
"true"
,
ctx
,
gucsourc
e
);
if
(
DebugLvl
>=
5
)
if
(
DebugLvl
>=
5
)
SetConfigOption
(
"debug_print_rewritten"
,
"true"
,
ctx
,
tru
e
);
SetConfigOption
(
"debug_print_rewritten"
,
"true"
,
ctx
,
gucsourc
e
);
break
;
break
;
case
'E'
:
case
'E'
:
...
@@ -1232,7 +1234,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1232,7 +1234,7 @@ PostgresMain(int argc, char *argv[], const char *username)
/*
/*
* turn off fsync
* turn off fsync
*/
*/
SetConfigOption
(
"fsync"
,
"false"
,
ctx
,
tru
e
);
SetConfigOption
(
"fsync"
,
"false"
,
ctx
,
gucsourc
e
);
break
;
break
;
case
'f'
:
case
'f'
:
...
@@ -1265,7 +1267,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1265,7 +1267,7 @@ PostgresMain(int argc, char *argv[], const char *username)
errs
++
;
errs
++
;
}
}
if
(
tmp
)
if
(
tmp
)
SetConfigOption
(
tmp
,
"false"
,
ctx
,
tru
e
);
SetConfigOption
(
tmp
,
"false"
,
ctx
,
gucsourc
e
);
break
;
break
;
case
'i'
:
case
'i'
:
...
@@ -1319,6 +1321,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1319,6 +1321,7 @@ PostgresMain(int argc, char *argv[], const char *username)
secure
=
false
;
/* subsequent switches are NOT
secure
=
false
;
/* subsequent switches are NOT
* secure */
* secure */
ctx
=
PGC_BACKEND
;
ctx
=
PGC_BACKEND
;
gucsource
=
PGC_S_CLIENT
;
}
}
break
;
break
;
...
@@ -1327,7 +1330,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1327,7 +1330,7 @@ PostgresMain(int argc, char *argv[], const char *username)
/*
/*
* S - amount of sort memory to use in 1k bytes
* S - amount of sort memory to use in 1k bytes
*/
*/
SetConfigOption
(
"sort_mem"
,
optarg
,
ctx
,
tru
e
);
SetConfigOption
(
"sort_mem"
,
optarg
,
ctx
,
gucsourc
e
);
break
;
break
;
case
's'
:
case
's'
:
...
@@ -1335,7 +1338,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1335,7 +1338,7 @@ PostgresMain(int argc, char *argv[], const char *username)
/*
/*
* s - report usage statistics (timings) after each query
* s - report usage statistics (timings) after each query
*/
*/
SetConfigOption
(
"show_query_stats"
,
"true"
,
ctx
,
tru
e
);
SetConfigOption
(
"show_query_stats"
,
"true"
,
ctx
,
gucsourc
e
);
break
;
break
;
case
't'
:
case
't'
:
...
@@ -1368,7 +1371,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1368,7 +1371,7 @@ PostgresMain(int argc, char *argv[], const char *username)
break
;
break
;
}
}
if
(
tmp
)
if
(
tmp
)
SetConfigOption
(
tmp
,
"true"
,
ctx
,
tru
e
);
SetConfigOption
(
tmp
,
"true"
,
ctx
,
gucsourc
e
);
break
;
break
;
case
'v'
:
case
'v'
:
...
@@ -1432,7 +1435,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1432,7 +1435,7 @@ PostgresMain(int argc, char *argv[], const char *username)
elog
(
ERROR
,
"-c %s requires argument"
,
optarg
);
elog
(
ERROR
,
"-c %s requires argument"
,
optarg
);
}
}
SetConfigOption
(
name
,
value
,
ctx
,
tru
e
);
SetConfigOption
(
name
,
value
,
ctx
,
gucsourc
e
);
free
(
name
);
free
(
name
);
if
(
value
)
if
(
value
)
free
(
value
);
free
(
value
);
...
@@ -1451,7 +1454,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1451,7 +1454,7 @@ PostgresMain(int argc, char *argv[], const char *username)
(
Show_parser_stats
||
Show_planner_stats
||
Show_executor_stats
))
(
Show_parser_stats
||
Show_planner_stats
||
Show_executor_stats
))
{
{
elog
(
NOTICE
,
"Query statistics are disabled because parser, planner, or executor statistics are on."
);
elog
(
NOTICE
,
"Query statistics are disabled because parser, planner, or executor statistics are on."
);
SetConfigOption
(
"show_query_stats"
,
"false"
,
ctx
,
tru
e
);
SetConfigOption
(
"show_query_stats"
,
"false"
,
ctx
,
gucsourc
e
);
}
}
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
)
...
@@ -1623,7 +1626,7 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -1623,7 +1626,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
)
{
{
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"$Revision: 1.24
6 $ $Date: 2002/02/19 19:54:43
$
\n
"
);
puts
(
"$Revision: 1.24
7 $ $Date: 2002/02/23 01:31:36
$
\n
"
);
}
}
/*
/*
...
...
src/backend/utils/misc/guc-file.l
View file @
51f19558
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.
9 2001/08/06 13:45:15
petere Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.
10 2002/02/23 01:31:36
petere Exp $
*/
*/
%{
%{
...
@@ -240,13 +240,15 @@ ProcessConfigFile(GucContext context)
...
@@ -240,13 +240,15 @@ ProcessConfigFile(GucContext context)
*/
*/
for(item = head; item; item=item->next)
for(item = head; item; item=item->next)
{
{
if (!set_config_option(item->name, item->value, context, false, false))
if (!set_config_option(item->name, item->value, context,
false, PGC_S_INFINITY))
goto cleanup_exit;
goto cleanup_exit;
}
}
/* If we got here all the options parsed okay. */
/* If we got here all the options parsed okay. */
for(item = head; item; item=item->next)
for(item = head; item; item=item->next)
set_config_option(item->name, item->value, context, true, true);
set_config_option(item->name, item->value, context,
true, PGC_S_FILE);
cleanup_exit:
cleanup_exit:
free_name_value_list(head);
free_name_value_list(head);
...
...
src/backend/utils/misc/guc.c
View file @
51f19558
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* Support for grand unified configuration scheme, including SET
* Support for grand unified configuration scheme, including SET
* command, configuration file, and command line options.
* command, configuration file, and command line options.
*
*
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.5
8 2001/10/30 05:38:56 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.5
9 2002/02/23 01:31:36 petere
Exp $
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
* Written by Peter Eisentraut <peter_e@gmx.net>.
...
@@ -107,6 +107,7 @@ struct config_generic
...
@@ -107,6 +107,7 @@ struct config_generic
{
{
const
char
*
name
;
const
char
*
name
;
GucContext
context
;
GucContext
context
;
GucSource
source
;
void
*
variable
;
void
*
variable
;
};
};
...
@@ -115,6 +116,7 @@ struct config_bool
...
@@ -115,6 +116,7 @@ struct config_bool
{
{
const
char
*
name
;
const
char
*
name
;
GucContext
context
;
GucContext
context
;
GucSource
source
;
bool
*
variable
;
bool
*
variable
;
bool
default_val
;
bool
default_val
;
/* No need for parse_hook ... presumably both values are legal */
/* No need for parse_hook ... presumably both values are legal */
...
@@ -126,6 +128,7 @@ struct config_int
...
@@ -126,6 +128,7 @@ struct config_int
{
{
const
char
*
name
;
const
char
*
name
;
GucContext
context
;
GucContext
context
;
GucSource
source
;
int
*
variable
;
int
*
variable
;
int
default_val
;
int
default_val
;
int
min
;
int
min
;
...
@@ -139,6 +142,7 @@ struct config_real
...
@@ -139,6 +142,7 @@ struct config_real
{
{
const
char
*
name
;
const
char
*
name
;
GucContext
context
;
GucContext
context
;
GucSource
source
;
double
*
variable
;
double
*
variable
;
double
default_val
;
double
default_val
;
double
min
;
double
min
;
...
@@ -157,6 +161,7 @@ struct config_string
...
@@ -157,6 +161,7 @@ struct config_string
{
{
const
char
*
name
;
const
char
*
name
;
GucContext
context
;
GucContext
context
;
GucSource
source
;
char
**
variable
;
char
**
variable
;
const
char
*
boot_default_val
;
const
char
*
boot_default_val
;
bool
(
*
parse_hook
)
(
const
char
*
proposed
);
bool
(
*
parse_hook
)
(
const
char
*
proposed
);
...
@@ -193,157 +198,157 @@ static struct config_bool
...
@@ -193,157 +198,157 @@ static struct config_bool
ConfigureNamesBool
[]
=
ConfigureNamesBool
[]
=
{
{
{
{
"enable_seqscan"
,
PGC_USERSET
,
&
enable_seqscan
,
true
,
NULL
"enable_seqscan"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
enable_seqscan
,
true
,
NULL
},
},
{
{
"enable_indexscan"
,
PGC_USERSET
,
&
enable_indexscan
,
true
,
NULL
"enable_indexscan"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
enable_indexscan
,
true
,
NULL
},
},
{
{
"enable_tidscan"
,
PGC_USERSET
,
&
enable_tidscan
,
true
,
NULL
"enable_tidscan"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
enable_tidscan
,
true
,
NULL
},
},
{
{
"enable_sort"
,
PGC_USERSET
,
&
enable_sort
,
true
,
NULL
"enable_sort"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
enable_sort
,
true
,
NULL
},
},
{
{
"enable_nestloop"
,
PGC_USERSET
,
&
enable_nestloop
,
true
,
NULL
"enable_nestloop"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
enable_nestloop
,
true
,
NULL
},
},
{
{
"enable_mergejoin"
,
PGC_USERSET
,
&
enable_mergejoin
,
true
,
NULL
"enable_mergejoin"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
enable_mergejoin
,
true
,
NULL
},
},
{
{
"enable_hashjoin"
,
PGC_USERSET
,
&
enable_hashjoin
,
true
,
NULL
"enable_hashjoin"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
enable_hashjoin
,
true
,
NULL
},
},
{
{
"ksqo"
,
PGC_USERSET
,
&
_use_keyset_query_optimizer
,
false
,
NULL
"ksqo"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
_use_keyset_query_optimizer
,
false
,
NULL
},
},
{
{
"geqo"
,
PGC_USERSET
,
&
enable_geqo
,
true
,
NULL
"geqo"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
enable_geqo
,
true
,
NULL
},
},
{
{
"tcpip_socket"
,
PGC_POSTMASTER
,
&
NetServer
,
false
,
NULL
"tcpip_socket"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
NetServer
,
false
,
NULL
},
},
{
{
"ssl"
,
PGC_POSTMASTER
,
&
EnableSSL
,
false
,
NULL
"ssl"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
EnableSSL
,
false
,
NULL
},
},
{
{
"fsync"
,
PGC_SIGHUP
,
&
enableFsync
,
true
,
NULL
"fsync"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
enableFsync
,
true
,
NULL
},
},
{
{
"silent_mode"
,
PGC_POSTMASTER
,
&
SilentMode
,
false
,
NULL
"silent_mode"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
SilentMode
,
false
,
NULL
},
},
{
{
"log_connections"
,
PGC_BACKEND
,
&
Log_connections
,
false
,
NULL
"log_connections"
,
PGC_BACKEND
,
PGC_S_DEFAULT
,
&
Log_connections
,
false
,
NULL
},
},
{
{
"log_timestamp"
,
PGC_SIGHUP
,
&
Log_timestamp
,
false
,
NULL
"log_timestamp"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
Log_timestamp
,
false
,
NULL
},
},
{
{
"log_pid"
,
PGC_SIGHUP
,
&
Log_pid
,
false
,
NULL
"log_pid"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
Log_pid
,
false
,
NULL
},
},
#ifdef USE_ASSERT_CHECKING
#ifdef USE_ASSERT_CHECKING
{
{
"debug_assertions"
,
PGC_USERSET
,
&
assert_enabled
,
true
,
NULL
"debug_assertions"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
assert_enabled
,
true
,
NULL
},
},
#endif
#endif
{
{
"debug_print_query"
,
PGC_USERSET
,
&
Debug_print_query
,
false
,
NULL
"debug_print_query"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Debug_print_query
,
false
,
NULL
},
},
{
{
"debug_print_parse"
,
PGC_USERSET
,
&
Debug_print_parse
,
false
,
NULL
"debug_print_parse"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Debug_print_parse
,
false
,
NULL
},
},
{
{
"debug_print_rewritten"
,
PGC_USERSET
,
&
Debug_print_rewritten
,
false
,
NULL
"debug_print_rewritten"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Debug_print_rewritten
,
false
,
NULL
},
},
{
{
"debug_print_plan"
,
PGC_USERSET
,
&
Debug_print_plan
,
false
,
NULL
"debug_print_plan"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Debug_print_plan
,
false
,
NULL
},
},
{
{
"debug_pretty_print"
,
PGC_USERSET
,
&
Debug_pretty_print
,
false
,
NULL
"debug_pretty_print"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Debug_pretty_print
,
false
,
NULL
},
},
{
{
"show_parser_stats"
,
PGC_USERSET
,
&
Show_parser_stats
,
false
,
NULL
"show_parser_stats"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Show_parser_stats
,
false
,
NULL
},
},
{
{
"show_planner_stats"
,
PGC_USERSET
,
&
Show_planner_stats
,
false
,
NULL
"show_planner_stats"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Show_planner_stats
,
false
,
NULL
},
},
{
{
"show_executor_stats"
,
PGC_USERSET
,
&
Show_executor_stats
,
false
,
NULL
"show_executor_stats"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Show_executor_stats
,
false
,
NULL
},
},
{
{
"show_query_stats"
,
PGC_USERSET
,
&
Show_query_stats
,
false
,
NULL
"show_query_stats"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Show_query_stats
,
false
,
NULL
},
},
#ifdef BTREE_BUILD_STATS
#ifdef BTREE_BUILD_STATS
{
{
"show_btree_build_stats"
,
PGC_SUSET
,
&
Show_btree_build_stats
,
false
,
NULL
"show_btree_build_stats"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
Show_btree_build_stats
,
false
,
NULL
},
},
#endif
#endif
{
{
"stats_start_collector"
,
PGC_POSTMASTER
,
&
pgstat_collect_startcollector
,
true
,
NULL
"stats_start_collector"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
pgstat_collect_startcollector
,
true
,
NULL
},
},
{
{
"stats_reset_on_server_start"
,
PGC_POSTMASTER
,
&
pgstat_collect_resetonpmstart
,
true
,
NULL
"stats_reset_on_server_start"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
pgstat_collect_resetonpmstart
,
true
,
NULL
},
},
{
{
"stats_command_string"
,
PGC_SUSET
,
&
pgstat_collect_querystring
,
false
,
NULL
"stats_command_string"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
pgstat_collect_querystring
,
false
,
NULL
},
},
{
{
"stats_row_level"
,
PGC_SUSET
,
&
pgstat_collect_tuplelevel
,
false
,
NULL
"stats_row_level"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
pgstat_collect_tuplelevel
,
false
,
NULL
},
},
{
{
"stats_block_level"
,
PGC_SUSET
,
&
pgstat_collect_blocklevel
,
false
,
NULL
"stats_block_level"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
pgstat_collect_blocklevel
,
false
,
NULL
},
},
{
{
"trace_notify"
,
PGC_USERSET
,
&
Trace_notify
,
false
,
NULL
"trace_notify"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Trace_notify
,
false
,
NULL
},
},
#ifdef LOCK_DEBUG
#ifdef LOCK_DEBUG
{
{
"trace_locks"
,
PGC_SUSET
,
&
Trace_locks
,
false
,
NULL
"trace_locks"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
Trace_locks
,
false
,
NULL
},
},
{
{
"trace_userlocks"
,
PGC_SUSET
,
&
Trace_userlocks
,
false
,
NULL
"trace_userlocks"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
Trace_userlocks
,
false
,
NULL
},
},
{
{
"trace_lwlocks"
,
PGC_SUSET
,
&
Trace_lwlocks
,
false
,
NULL
"trace_lwlocks"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
Trace_lwlocks
,
false
,
NULL
},
},
{
{
"debug_deadlocks"
,
PGC_SUSET
,
&
Debug_deadlocks
,
false
,
NULL
"debug_deadlocks"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
Debug_deadlocks
,
false
,
NULL
},
},
#endif
#endif
{
{
"hostname_lookup"
,
PGC_SIGHUP
,
&
HostnameLookup
,
false
,
NULL
"hostname_lookup"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
HostnameLookup
,
false
,
NULL
},
},
{
{
"show_source_port"
,
PGC_SIGHUP
,
&
ShowPortNumber
,
false
,
NULL
"show_source_port"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
ShowPortNumber
,
false
,
NULL
},
},
{
{
"sql_inheritance"
,
PGC_USERSET
,
&
SQL_inheritance
,
true
,
NULL
"sql_inheritance"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
SQL_inheritance
,
true
,
NULL
},
},
{
{
"australian_timezones"
,
PGC_USERSET
,
&
Australian_timezones
,
false
,
ClearDateCache
"australian_timezones"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Australian_timezones
,
false
,
ClearDateCache
},
},
{
{
"fixbtree"
,
PGC_POSTMASTER
,
&
FixBTree
,
true
,
NULL
"fixbtree"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
FixBTree
,
true
,
NULL
},
},
{
{
"password_encryption"
,
PGC_USERSET
,
&
Password_encryption
,
false
,
NULL
"password_encryption"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Password_encryption
,
false
,
NULL
},
},
{
{
"transform_null_equals"
,
PGC_USERSET
,
&
Transform_null_equals
,
false
,
NULL
"transform_null_equals"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Transform_null_equals
,
false
,
NULL
},
},
{
{
NULL
,
0
,
NULL
,
false
,
NULL
NULL
,
0
,
0
,
NULL
,
false
,
NULL
}
}
};
};
...
@@ -352,34 +357,34 @@ static struct config_int
...
@@ -352,34 +357,34 @@ static struct config_int
ConfigureNamesInt
[]
=
ConfigureNamesInt
[]
=
{
{
{
{
"geqo_threshold"
,
PGC_USERSET
,
&
geqo_rels
,
"geqo_threshold"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
geqo_rels
,
DEFAULT_GEQO_RELS
,
2
,
INT_MAX
,
NULL
,
NULL
DEFAULT_GEQO_RELS
,
2
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"geqo_pool_size"
,
PGC_USERSET
,
&
Geqo_pool_size
,
"geqo_pool_size"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Geqo_pool_size
,
DEFAULT_GEQO_POOL_SIZE
,
0
,
MAX_GEQO_POOL_SIZE
,
NULL
,
NULL
DEFAULT_GEQO_POOL_SIZE
,
0
,
MAX_GEQO_POOL_SIZE
,
NULL
,
NULL
},
},
{
{
"geqo_effort"
,
PGC_USERSET
,
&
Geqo_effort
,
"geqo_effort"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Geqo_effort
,
1
,
1
,
INT_MAX
,
NULL
,
NULL
1
,
1
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"geqo_generations"
,
PGC_USERSET
,
&
Geqo_generations
,
"geqo_generations"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Geqo_generations
,
0
,
0
,
INT_MAX
,
NULL
,
NULL
0
,
0
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"geqo_random_seed"
,
PGC_USERSET
,
&
Geqo_random_seed
,
"geqo_random_seed"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Geqo_random_seed
,
-
1
,
INT_MIN
,
INT_MAX
,
NULL
,
NULL
-
1
,
INT_MIN
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"deadlock_timeout"
,
PGC_POSTMASTER
,
&
DeadlockTimeout
,
"deadlock_timeout"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
DeadlockTimeout
,
1000
,
0
,
INT_MAX
,
NULL
,
NULL
1000
,
0
,
INT_MAX
,
NULL
,
NULL
},
},
#ifdef ENABLE_SYSLOG
#ifdef ENABLE_SYSLOG
{
{
"syslog"
,
PGC_SIGHUP
,
&
Use_syslog
,
"syslog"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
Use_syslog
,
0
,
0
,
2
,
NULL
,
NULL
0
,
0
,
2
,
NULL
,
NULL
},
},
#endif
#endif
...
@@ -390,121 +395,121 @@ static struct config_int
...
@@ -390,121 +395,121 @@ static struct config_int
* constraints here are partially unused.
* constraints here are partially unused.
*/
*/
{
{
"max_connections"
,
PGC_POSTMASTER
,
&
MaxBackends
,
"max_connections"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
MaxBackends
,
DEF_MAXBACKENDS
,
1
,
INT_MAX
,
NULL
,
NULL
DEF_MAXBACKENDS
,
1
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"shared_buffers"
,
PGC_POSTMASTER
,
&
NBuffers
,
"shared_buffers"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
NBuffers
,
DEF_NBUFFERS
,
16
,
INT_MAX
,
NULL
,
NULL
DEF_NBUFFERS
,
16
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"port"
,
PGC_POSTMASTER
,
&
PostPortNumber
,
"port"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
PostPortNumber
,
DEF_PGPORT
,
1
,
65535
,
NULL
,
NULL
DEF_PGPORT
,
1
,
65535
,
NULL
,
NULL
},
},
{
{
"unix_socket_permissions"
,
PGC_POSTMASTER
,
&
Unix_socket_permissions
,
"unix_socket_permissions"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
Unix_socket_permissions
,
0777
,
0000
,
0777
,
NULL
,
NULL
0777
,
0000
,
0777
,
NULL
,
NULL
},
},
{
{
"sort_mem"
,
PGC_USERSET
,
&
SortMem
,
"sort_mem"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
SortMem
,
512
,
4
*
BLCKSZ
/
1024
,
INT_MAX
,
NULL
,
NULL
512
,
4
*
BLCKSZ
/
1024
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"vacuum_mem"
,
PGC_USERSET
,
&
VacuumMem
,
"vacuum_mem"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
VacuumMem
,
8192
,
1024
,
INT_MAX
,
NULL
,
NULL
8192
,
1024
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"max_files_per_process"
,
PGC_BACKEND
,
&
max_files_per_process
,
"max_files_per_process"
,
PGC_BACKEND
,
PGC_S_DEFAULT
,
&
max_files_per_process
,
1000
,
25
,
INT_MAX
,
NULL
,
NULL
1000
,
25
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"debug_level"
,
PGC_USERSET
,
&
DebugLvl
,
"debug_level"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
DebugLvl
,
0
,
0
,
16
,
NULL
,
NULL
0
,
0
,
16
,
NULL
,
NULL
},
},
#ifdef LOCK_DEBUG
#ifdef LOCK_DEBUG
{
{
"trace_lock_oidmin"
,
PGC_SUSET
,
&
Trace_lock_oidmin
,
"trace_lock_oidmin"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
Trace_lock_oidmin
,
BootstrapObjectIdData
,
1
,
INT_MAX
,
NULL
,
NULL
BootstrapObjectIdData
,
1
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"trace_lock_table"
,
PGC_SUSET
,
&
Trace_lock_table
,
"trace_lock_table"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
Trace_lock_table
,
0
,
0
,
INT_MAX
,
NULL
,
NULL
0
,
0
,
INT_MAX
,
NULL
,
NULL
},
},
#endif
#endif
{
{
"max_expr_depth"
,
PGC_USERSET
,
&
max_expr_depth
,
"max_expr_depth"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
max_expr_depth
,
DEFAULT_MAX_EXPR_DEPTH
,
10
,
INT_MAX
,
NULL
,
NULL
DEFAULT_MAX_EXPR_DEPTH
,
10
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"max_fsm_relations"
,
PGC_POSTMASTER
,
&
MaxFSMRelations
,
"max_fsm_relations"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
MaxFSMRelations
,
100
,
10
,
INT_MAX
,
NULL
,
NULL
100
,
10
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"max_fsm_pages"
,
PGC_POSTMASTER
,
&
MaxFSMPages
,
"max_fsm_pages"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
MaxFSMPages
,
10000
,
1000
,
INT_MAX
,
NULL
,
NULL
10000
,
1000
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"max_locks_per_transaction"
,
PGC_POSTMASTER
,
&
max_locks_per_xact
,
"max_locks_per_transaction"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
max_locks_per_xact
,
64
,
10
,
INT_MAX
,
NULL
,
NULL
64
,
10
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"authentication_timeout"
,
PGC_SIGHUP
,
&
AuthenticationTimeout
,
"authentication_timeout"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
AuthenticationTimeout
,
60
,
1
,
600
,
NULL
,
NULL
60
,
1
,
600
,
NULL
,
NULL
},
},
{
{
"pre_auth_delay"
,
PGC_SIGHUP
,
&
PreAuthDelay
,
"pre_auth_delay"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
PreAuthDelay
,
0
,
0
,
60
,
NULL
,
NULL
0
,
0
,
60
,
NULL
,
NULL
},
},
{
{
"checkpoint_segments"
,
PGC_SIGHUP
,
&
CheckPointSegments
,
"checkpoint_segments"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
CheckPointSegments
,
3
,
1
,
INT_MAX
,
NULL
,
NULL
3
,
1
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"checkpoint_timeout"
,
PGC_SIGHUP
,
&
CheckPointTimeout
,
"checkpoint_timeout"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
CheckPointTimeout
,
300
,
30
,
3600
,
NULL
,
NULL
300
,
30
,
3600
,
NULL
,
NULL
},
},
{
{
"wal_buffers"
,
PGC_POSTMASTER
,
&
XLOGbuffers
,
"wal_buffers"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
XLOGbuffers
,
8
,
4
,
INT_MAX
,
NULL
,
NULL
8
,
4
,
INT_MAX
,
NULL
,
NULL
},
},
{
{
"wal_files"
,
PGC_SIGHUP
,
&
XLOGfiles
,
"wal_files"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
XLOGfiles
,
0
,
0
,
64
,
NULL
,
NULL
0
,
0
,
64
,
NULL
,
NULL
},
},
{
{
"wal_debug"
,
PGC_SUSET
,
&
XLOG_DEBUG
,
"wal_debug"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
XLOG_DEBUG
,
0
,
0
,
16
,
NULL
,
NULL
0
,
0
,
16
,
NULL
,
NULL
},
},
{
{
"commit_delay"
,
PGC_USERSET
,
&
CommitDelay
,
"commit_delay"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
CommitDelay
,
0
,
0
,
100000
,
NULL
,
NULL
0
,
0
,
100000
,
NULL
,
NULL
},
},
{
{
"commit_siblings"
,
PGC_USERSET
,
&
CommitSiblings
,
"commit_siblings"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
CommitSiblings
,
5
,
1
,
1000
,
NULL
,
NULL
5
,
1
,
1000
,
NULL
,
NULL
},
},
{
{
NULL
,
0
,
NULL
,
0
,
0
,
0
,
NULL
,
NULL
NULL
,
0
,
0
,
NULL
,
0
,
0
,
0
,
NULL
,
NULL
}
}
};
};
...
@@ -513,34 +518,34 @@ static struct config_real
...
@@ -513,34 +518,34 @@ static struct config_real
ConfigureNamesReal
[]
=
ConfigureNamesReal
[]
=
{
{
{
{
"effective_cache_size"
,
PGC_USERSET
,
&
effective_cache_size
,
"effective_cache_size"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
effective_cache_size
,
DEFAULT_EFFECTIVE_CACHE_SIZE
,
0
,
DBL_MAX
,
NULL
,
NULL
DEFAULT_EFFECTIVE_CACHE_SIZE
,
0
,
DBL_MAX
,
NULL
,
NULL
},
},
{
{
"random_page_cost"
,
PGC_USERSET
,
&
random_page_cost
,
"random_page_cost"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
random_page_cost
,
DEFAULT_RANDOM_PAGE_COST
,
0
,
DBL_MAX
,
NULL
,
NULL
DEFAULT_RANDOM_PAGE_COST
,
0
,
DBL_MAX
,
NULL
,
NULL
},
},
{
{
"cpu_tuple_cost"
,
PGC_USERSET
,
&
cpu_tuple_cost
,
"cpu_tuple_cost"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
cpu_tuple_cost
,
DEFAULT_CPU_TUPLE_COST
,
0
,
DBL_MAX
,
NULL
,
NULL
DEFAULT_CPU_TUPLE_COST
,
0
,
DBL_MAX
,
NULL
,
NULL
},
},
{
{
"cpu_index_tuple_cost"
,
PGC_USERSET
,
&
cpu_index_tuple_cost
,
"cpu_index_tuple_cost"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
cpu_index_tuple_cost
,
DEFAULT_CPU_INDEX_TUPLE_COST
,
0
,
DBL_MAX
,
NULL
,
NULL
DEFAULT_CPU_INDEX_TUPLE_COST
,
0
,
DBL_MAX
,
NULL
,
NULL
},
},
{
{
"cpu_operator_cost"
,
PGC_USERSET
,
&
cpu_operator_cost
,
"cpu_operator_cost"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
cpu_operator_cost
,
DEFAULT_CPU_OPERATOR_COST
,
0
,
DBL_MAX
,
NULL
,
NULL
DEFAULT_CPU_OPERATOR_COST
,
0
,
DBL_MAX
,
NULL
,
NULL
},
},
{
{
"geqo_selection_bias"
,
PGC_USERSET
,
&
Geqo_selection_bias
,
"geqo_selection_bias"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
Geqo_selection_bias
,
DEFAULT_GEQO_SELECTION_BIAS
,
MIN_GEQO_SELECTION_BIAS
,
DEFAULT_GEQO_SELECTION_BIAS
,
MIN_GEQO_SELECTION_BIAS
,
MAX_GEQO_SELECTION_BIAS
,
NULL
,
NULL
MAX_GEQO_SELECTION_BIAS
,
NULL
,
NULL
},
},
{
{
NULL
,
0
,
NULL
,
0
.
0
,
0
.
0
,
0
.
0
,
NULL
,
NULL
NULL
,
0
,
0
,
NULL
,
0
.
0
,
0
.
0
,
0
.
0
,
NULL
,
NULL
}
}
};
};
...
@@ -549,54 +554,54 @@ static struct config_string
...
@@ -549,54 +554,54 @@ static struct config_string
ConfigureNamesString
[]
=
ConfigureNamesString
[]
=
{
{
{
{
"default_transaction_isolation"
,
PGC_USERSET
,
&
default_iso_level_string
,
"default_transaction_isolation"
,
PGC_USERSET
,
PGC_S_DEFAULT
,
&
default_iso_level_string
,
"read committed"
,
check_defaultxactisolevel
,
assign_defaultxactisolevel
"read committed"
,
check_defaultxactisolevel
,
assign_defaultxactisolevel
},
},
{
{
"dynamic_library_path"
,
PGC_SUSET
,
&
Dynamic_library_path
,
"dynamic_library_path"
,
PGC_SUSET
,
PGC_S_DEFAULT
,
&
Dynamic_library_path
,
"$libdir"
,
NULL
,
NULL
"$libdir"
,
NULL
,
NULL
},
},
{
{
"krb_server_keyfile"
,
PGC_POSTMASTER
,
&
pg_krb_server_keyfile
,
"krb_server_keyfile"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
pg_krb_server_keyfile
,
PG_KRB_SRVTAB
,
NULL
,
NULL
PG_KRB_SRVTAB
,
NULL
,
NULL
},
},
#ifdef ENABLE_SYSLOG
#ifdef ENABLE_SYSLOG
{
{
"syslog_facility"
,
PGC_POSTMASTER
,
&
Syslog_facility
,
"syslog_facility"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
Syslog_facility
,
"LOCAL0"
,
check_facility
,
NULL
"LOCAL0"
,
check_facility
,
NULL
},
},
{
{
"syslog_ident"
,
PGC_POSTMASTER
,
&
Syslog_ident
,
"syslog_ident"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
Syslog_ident
,
"postgres"
,
NULL
,
NULL
"postgres"
,
NULL
,
NULL
},
},
#endif
#endif
{
{
"unix_socket_group"
,
PGC_POSTMASTER
,
&
Unix_socket_group
,
"unix_socket_group"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
Unix_socket_group
,
""
,
NULL
,
NULL
""
,
NULL
,
NULL
},
},
{
{
"unix_socket_directory"
,
PGC_POSTMASTER
,
&
UnixSocketDir
,
"unix_socket_directory"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
UnixSocketDir
,
""
,
NULL
,
NULL
""
,
NULL
,
NULL
},
},
{
{
"virtual_host"
,
PGC_POSTMASTER
,
&
VirtualHost
,
"virtual_host"
,
PGC_POSTMASTER
,
PGC_S_DEFAULT
,
&
VirtualHost
,
""
,
NULL
,
NULL
""
,
NULL
,
NULL
},
},
{
{
"wal_sync_method"
,
PGC_SIGHUP
,
&
XLOG_sync_method
,
"wal_sync_method"
,
PGC_SIGHUP
,
PGC_S_DEFAULT
,
&
XLOG_sync_method
,
XLOG_sync_method_default
,
check_xlog_sync_method
,
XLOG_sync_method_default
,
check_xlog_sync_method
,
assign_xlog_sync_method
assign_xlog_sync_method
},
},
{
{
NULL
,
0
,
NULL
,
NULL
,
NULL
,
NULL
NULL
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
}
}
};
};
...
@@ -870,11 +875,12 @@ parse_real(const char *value, double *result)
...
@@ -870,11 +875,12 @@ parse_real(const char *value, double *result)
*/
*/
bool
bool
set_config_option
(
const
char
*
name
,
const
char
*
value
,
set_config_option
(
const
char
*
name
,
const
char
*
value
,
GucContext
context
,
bool
DoIt
,
bool
makeDefault
)
GucContext
context
,
bool
DoIt
,
GucSource
source
)
{
{
struct
config_generic
*
record
;
struct
config_generic
*
record
;
enum
config_type
type
;
enum
config_type
type
;
int
elevel
;
int
elevel
;
bool
makeDefault
;
elevel
=
(
context
==
PGC_SIGHUP
)
?
DEBUG
:
ERROR
;
elevel
=
(
context
==
PGC_SIGHUP
)
?
DEBUG
:
ERROR
;
...
@@ -885,6 +891,15 @@ set_config_option(const char *name, const char *value,
...
@@ -885,6 +891,15 @@ set_config_option(const char *name, const char *value,
return
false
;
return
false
;
}
}
if
(
record
->
source
>
source
)
{
if
(
DebugLvl
>
1
)
elog
(
DEBUG
,
"setting %s refused because previous source is higher"
,
name
);
return
false
;
}
makeDefault
=
source
<
PGC_S_SESSION
;
/*
/*
* Check if the option can be set at this time. See guc.h for the
* Check if the option can be set at this time. See guc.h for the
* precise rules. Note that we don't want to throw errors if we're in
* precise rules. Note that we don't want to throw errors if we're in
...
@@ -961,6 +976,7 @@ set_config_option(const char *name, const char *value,
...
@@ -961,6 +976,7 @@ set_config_option(const char *name, const char *value,
*
conf
->
variable
=
boolval
;
*
conf
->
variable
=
boolval
;
if
(
makeDefault
)
if
(
makeDefault
)
conf
->
default_val
=
boolval
;
conf
->
default_val
=
boolval
;
conf
->
source
=
source
;
}
}
}
}
else
if
(
DoIt
)
else
if
(
DoIt
)
...
@@ -1005,6 +1021,7 @@ set_config_option(const char *name, const char *value,
...
@@ -1005,6 +1021,7 @@ set_config_option(const char *name, const char *value,
*
conf
->
variable
=
intval
;
*
conf
->
variable
=
intval
;
if
(
makeDefault
)
if
(
makeDefault
)
conf
->
default_val
=
intval
;
conf
->
default_val
=
intval
;
conf
->
source
=
source
;
}
}
}
}
else
if
(
DoIt
)
else
if
(
DoIt
)
...
@@ -1049,6 +1066,7 @@ set_config_option(const char *name, const char *value,
...
@@ -1049,6 +1066,7 @@ set_config_option(const char *name, const char *value,
*
conf
->
variable
=
dval
;
*
conf
->
variable
=
dval
;
if
(
makeDefault
)
if
(
makeDefault
)
conf
->
default_val
=
dval
;
conf
->
default_val
=
dval
;
conf
->
source
=
source
;
}
}
}
}
else
if
(
DoIt
)
else
if
(
DoIt
)
...
@@ -1099,6 +1117,7 @@ set_config_option(const char *name, const char *value,
...
@@ -1099,6 +1117,7 @@ set_config_option(const char *name, const char *value,
free
(
conf
->
default_val
);
free
(
conf
->
default_val
);
conf
->
default_val
=
str
;
conf
->
default_val
=
str
;
}
}
conf
->
source
=
source
;
}
}
}
}
else
if
(
DoIt
)
else
if
(
DoIt
)
...
@@ -1143,9 +1162,9 @@ set_config_option(const char *name, const char *value,
...
@@ -1143,9 +1162,9 @@ set_config_option(const char *name, const char *value,
*/
*/
void
void
SetConfigOption
(
const
char
*
name
,
const
char
*
value
,
SetConfigOption
(
const
char
*
name
,
const
char
*
value
,
GucContext
context
,
bool
makeDefault
)
GucContext
context
,
GucSource
source
)
{
{
(
void
)
set_config_option
(
name
,
value
,
context
,
true
,
makeDefault
);
(
void
)
set_config_option
(
name
,
value
,
context
,
true
,
source
);
}
}
...
...
src/include/utils/guc.h
View file @
51f19558
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* External declarations pertaining to backend/utils/misc/guc.c and
* External declarations pertaining to backend/utils/misc/guc.c and
* backend/utils/misc/guc-file.l
* backend/utils/misc/guc-file.l
*
*
* $Id: guc.h,v 1.1
3 2001/11/05 17:46:36 momjian
Exp $
* $Id: guc.h,v 1.1
4 2002/02/23 01:31:37 petere
Exp $
*/
*/
#ifndef GUC_H
#ifndef GUC_H
#define GUC_H
#define GUC_H
...
@@ -46,15 +46,32 @@ typedef enum
...
@@ -46,15 +46,32 @@ typedef enum
PGC_USERSET
PGC_USERSET
}
GucContext
;
}
GucContext
;
/*
* The following type records the source of the current setting. A
* new setting can only take effect if the previous setting had the
* same or lower level. (E.g, changing the config file doesn't
* override the postmaster command line.)
*/
typedef
enum
{
PGC_S_DEFAULT
=
0
,
/* wired-in default */
PGC_S_FILE
=
1
,
/* postgresql.conf */
PGC_S_ARGV
=
2
,
/* postmaster command line */
PGC_S_DATABASE
=
3
,
/* per-database setting */
PGC_S_USER
=
4
,
/* per-user setting */
PGC_S_CLIENT
=
5
,
/* from client (PGOPTIONS) */
PGC_S_SESSION
=
6
,
/* SET command */
PGC_S_INFINITY
=
100
/* can be used to avoid checks */
}
GucSource
;
extern
void
SetConfigOption
(
const
char
*
name
,
const
char
*
value
,
extern
void
SetConfigOption
(
const
char
*
name
,
const
char
*
value
,
GucContext
context
,
bool
makeDefault
);
GucContext
context
,
GucSource
source
);
extern
const
char
*
GetConfigOption
(
const
char
*
name
);
extern
const
char
*
GetConfigOption
(
const
char
*
name
);
extern
void
ProcessConfigFile
(
GucContext
context
);
extern
void
ProcessConfigFile
(
GucContext
context
);
extern
void
ResetAllOptions
(
bool
isStartup
);
extern
void
ResetAllOptions
(
bool
isStartup
);
extern
void
ParseLongOption
(
const
char
*
string
,
char
**
name
,
char
**
value
);
extern
void
ParseLongOption
(
const
char
*
string
,
char
**
name
,
char
**
value
);
extern
bool
set_config_option
(
const
char
*
name
,
const
char
*
value
,
extern
bool
set_config_option
(
const
char
*
name
,
const
char
*
value
,
GucContext
context
,
bool
DoIt
,
bool
makeDefault
);
GucContext
context
,
bool
DoIt
,
GucSource
source
);
extern
void
ShowAllGUCConfig
(
void
);
extern
void
ShowAllGUCConfig
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment