Add '-c name=val' flag for setting run-time parameters.
This commit is contained in:
parent
3304341700
commit
929a599369
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.31 2000/11/01 21:14:00 petere Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.32 2000/11/08 17:57:45 petere Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<Chapter Id="runtime">
|
<Chapter Id="runtime">
|
||||||
@ -411,7 +411,7 @@ syslog = 2
|
|||||||
A second way to set these configuration parameters is to give them
|
A second way to set these configuration parameters is to give them
|
||||||
as a command line option to the postmaster, such as
|
as a command line option to the postmaster, such as
|
||||||
<programlisting>
|
<programlisting>
|
||||||
postmaster --log-connections=yes --syslog=2
|
postmaster -c log_connections=yes -c syslog=2
|
||||||
</programlisting>
|
</programlisting>
|
||||||
which would have the same effect as the previous example.
|
which would have the same effect as the previous example.
|
||||||
</para>
|
</para>
|
||||||
@ -422,7 +422,7 @@ postmaster --log-connections=yes --syslog=2
|
|||||||
<envar>PGOPTIONS</envar> can be used for this purpose on the
|
<envar>PGOPTIONS</envar> can be used for this purpose on the
|
||||||
client side:
|
client side:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
env PGOPTIONS='--geqo=off' psql
|
env PGOPTIONS='-c geqo=off' psql
|
||||||
</programlisting>
|
</programlisting>
|
||||||
(This works for any client application, not just
|
(This works for any client application, not just
|
||||||
<application>psql</application>.) Note that this won't work for
|
<application>psql</application>.) Note that this won't work for
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.179 2000/11/06 22:18:06 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.180 2000/11/08 17:57:46 petere Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -372,7 +372,7 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
* will occur.
|
* will occur.
|
||||||
*/
|
*/
|
||||||
opterr = 1;
|
opterr = 1;
|
||||||
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:SsV-:?")) != EOF)
|
while ((opt = getopt(argc, argv, "A:a:B:b:c:D:d:Film:MN:no:p:SsV-:?")) != EOF)
|
||||||
{
|
{
|
||||||
switch(opt)
|
switch(opt)
|
||||||
{
|
{
|
||||||
@ -428,7 +428,7 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
#ifdef HAVE_INT_OPTRESET
|
#ifdef HAVE_INT_OPTRESET
|
||||||
optreset = 1;
|
optreset = 1;
|
||||||
#endif
|
#endif
|
||||||
while ((opt = getopt(argc, argv, "A:a:B:b:D:d:Film:MN:no:p:SsV-:?")) != EOF)
|
while ((opt = getopt(argc, argv, "A:a:B:b:c:D:d:Film:MN:no:p:SsV-:?")) != EOF)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
@ -530,13 +530,19 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
SendStop = true;
|
SendStop = true;
|
||||||
break;
|
break;
|
||||||
|
case 'c':
|
||||||
case '-':
|
case '-':
|
||||||
{
|
{
|
||||||
char *name, *value;
|
char *name, *value;
|
||||||
|
|
||||||
ParseLongOption(optarg, &name, &value);
|
ParseLongOption(optarg, &name, &value);
|
||||||
if (!value)
|
if (!value)
|
||||||
|
{
|
||||||
|
if (opt == '-')
|
||||||
elog(ERROR, "--%s requires argument", optarg);
|
elog(ERROR, "--%s requires argument", optarg);
|
||||||
|
else
|
||||||
|
elog(ERROR, "-c %s requires argument", optarg);
|
||||||
|
}
|
||||||
|
|
||||||
SetConfigOption(name, value, PGC_POSTMASTER);
|
SetConfigOption(name, value, PGC_POSTMASTER);
|
||||||
free(name);
|
free(name);
|
||||||
@ -766,6 +772,7 @@ usage(const char *progname)
|
|||||||
printf(" -A 1|0 enable/disable runtime assert checking\n");
|
printf(" -A 1|0 enable/disable runtime assert checking\n");
|
||||||
#endif
|
#endif
|
||||||
printf(" -B <buffers> number of shared buffers\n");
|
printf(" -B <buffers> number of shared buffers\n");
|
||||||
|
printf(" -c <name>=<value> set run-time parameter\n");
|
||||||
printf(" -d 1-5 debugging level\n");
|
printf(" -d 1-5 debugging level\n");
|
||||||
printf(" -D <directory> database directory\n");
|
printf(" -D <directory> database directory\n");
|
||||||
printf(" -F turn fsync off\n");
|
printf(" -F turn fsync off\n");
|
||||||
@ -775,7 +782,7 @@ usage(const char *progname)
|
|||||||
#endif
|
#endif
|
||||||
printf(" -N <number> maximum number of allowed connections (1..%d, default %d)\n",
|
printf(" -N <number> maximum number of allowed connections (1..%d, default %d)\n",
|
||||||
MAXBACKENDS, DEF_MAXBACKENDS);
|
MAXBACKENDS, DEF_MAXBACKENDS);
|
||||||
printf(" -o <option> pass `option' to each backend server\n");
|
printf(" -o <option> pass 'option' to each backend server\n");
|
||||||
printf(" -p <port> port number to listen on\n");
|
printf(" -p <port> port number to listen on\n");
|
||||||
printf(" -S silent mode (dissociate from tty)\n");
|
printf(" -S silent mode (dissociate from tty)\n");
|
||||||
|
|
||||||
@ -783,7 +790,7 @@ usage(const char *progname)
|
|||||||
printf(" -n don't reinitialize shared memory after abnormal exit\n");
|
printf(" -n don't reinitialize shared memory after abnormal exit\n");
|
||||||
printf(" -s send SIGSTOP to all backend servers if one dies\n");
|
printf(" -s send SIGSTOP to all backend servers if one dies\n");
|
||||||
|
|
||||||
printf("\nPlease read the documentation for the complete list of runtime\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");
|
"the configuration file.\n\n");
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.186 2000/11/06 22:18:08 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.187 2000/11/08 17:57:46 petere Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -1010,6 +1010,7 @@ usage(char *progname)
|
|||||||
fprintf(stderr, "\t-A on\t\tenable/disable assert checking\n");
|
fprintf(stderr, "\t-A on\t\tenable/disable assert checking\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, "\t-B buffers\tset number of buffers in buffer pool\n");
|
fprintf(stderr, "\t-B buffers\tset number of buffers in buffer pool\n");
|
||||||
|
fprintf(stderr, "\t-c name=value\tset run-time parameter\n");
|
||||||
fprintf(stderr, "\t-C \t\tsuppress version info\n");
|
fprintf(stderr, "\t-C \t\tsuppress version info\n");
|
||||||
fprintf(stderr, "\t-D dir\t\tdata directory\n");
|
fprintf(stderr, "\t-D dir\t\tdata directory\n");
|
||||||
fprintf(stderr, "\t-E \t\techo query before execution\n");
|
fprintf(stderr, "\t-E \t\techo query before execution\n");
|
||||||
@ -1112,7 +1113,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
|
|||||||
|
|
||||||
optind = 1; /* reset after postmaster's usage */
|
optind = 1; /* reset after postmaster's usage */
|
||||||
|
|
||||||
while ((flag = getopt(argc, argv, "A:B:CD:d:Eef:FiLNOPo:p:S:st:v:VW:x:-:?")) != EOF)
|
while ((flag = getopt(argc, argv, "A:B:c:CD:d:Eef:FiLNOPo:p:S:st:v:VW:x:-:?")) != EOF)
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -1383,6 +1384,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
case '-':
|
case '-':
|
||||||
{
|
{
|
||||||
char *name, *value;
|
char *name, *value;
|
||||||
@ -1399,7 +1401,12 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
if (!value)
|
if (!value)
|
||||||
|
{
|
||||||
|
if (flag == '-')
|
||||||
elog(ERROR, "--%s requires argument", optarg);
|
elog(ERROR, "--%s requires argument", optarg);
|
||||||
|
else
|
||||||
|
elog(ERROR, "-c %s requires argument", optarg);
|
||||||
|
}
|
||||||
|
|
||||||
SetConfigOption(name, value, PGC_BACKEND);
|
SetConfigOption(name, value, PGC_BACKEND);
|
||||||
free(name);
|
free(name);
|
||||||
@ -1639,7 +1646,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
|
|||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
puts("\nPOSTGRES backend interactive interface ");
|
puts("\nPOSTGRES backend interactive interface ");
|
||||||
puts("$Revision: 1.186 $ $Date: 2000/11/06 22:18:08 $\n");
|
puts("$Revision: 1.187 $ $Date: 2000/11/08 17:57:46 $\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user