]> granicus.if.org Git - postgresql/commitdiff
Add '-c name=val' flag for setting run-time parameters.
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 8 Nov 2000 17:57:46 +0000 (17:57 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 8 Nov 2000 17:57:46 +0000 (17:57 +0000)
doc/src/sgml/runtime.sgml
src/backend/postmaster/postmaster.c
src/backend/tcop/postgres.c

index 7544a6489ce9a6d20e863e0e0dcf6eac9ddf1f5b..539164758615e0890844002dc38e154aa6063b87 100644 (file)
@@ -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">
@@ -411,7 +411,7 @@ syslog = 2
     A second way to set these configuration parameters is to give them
     as a command line option to the postmaster, such as
 <programlisting>
-postmaster --log-connections=yes --syslog=2
+postmaster -c log_connections=yes -c syslog=2
 </programlisting>
     which would have the same effect as the previous example.
    </para>
@@ -422,7 +422,7 @@ postmaster --log-connections=yes --syslog=2
     <envar>PGOPTIONS</envar> can be used for this purpose on the
     client side:
 <programlisting>
-env PGOPTIONS='--geqo=off' psql
+env PGOPTIONS='-geqo=off' psql
 </programlisting>
     (This works for any client application, not just
     <application>psql</application>.) Note that this won't work for
index 192e5205a149b1f80931fa8dd4b4e4f68d523c9c..07e05485096f6ed1d511f4c0b2c864cd03a3b8b1 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * 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
  *
@@ -372,7 +372,7 @@ PostmasterMain(int argc, char *argv[])
         * will occur.
         */
        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)
                {
@@ -428,7 +428,7 @@ PostmasterMain(int argc, char *argv[])
 #ifdef HAVE_INT_OPTRESET
        optreset = 1;
 #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)
                {
@@ -530,13 +530,19 @@ PostmasterMain(int argc, char *argv[])
                                 */
                                SendStop = true;
                                break;
+                       case 'c':
                        case '-':
                        {
                                char *name, *value;
 
                                ParseLongOption(optarg, &name, &value);
                                if (!value)
-                                       elog(ERROR, "--%s requires argument", optarg);
+                               {
+                                       if (opt == '-')
+                                               elog(ERROR, "--%s requires argument", optarg);
+                                       else
+                                               elog(ERROR, "-c %s requires argument", optarg);
+                               }
 
                                SetConfigOption(name, value, PGC_POSTMASTER);
                                free(name);
@@ -766,6 +772,7 @@ usage(const char *progname)
        printf("  -A 1|0          enable/disable runtime assert checking\n");
 #endif
        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 <directory>  database directory\n");
        printf("  -F              turn fsync off\n");
@@ -775,7 +782,7 @@ usage(const char *progname)
 #endif
        printf("  -N <number>     maximum number of allowed connections (1..%d, default %d)\n",
                        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("  -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("  -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"
                   "the configuration file.\n\n");
 
index 3a6cc57d3d84f7837bad4a857c1516cf69408d69..8b84697d73cde452e52962c6cff921f3b2ad939f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * 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
  *       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");
 #endif
        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-D dir\t\tdata directory\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 */
 
-       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)
                {
                        case 'A':
@@ -1383,6 +1384,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
 #endif
                                break;
 
+                       case 'c':
                        case '-':
                        {
                                char *name, *value;
@@ -1399,7 +1401,12 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
                                        exit(0);
                                }
                                if (!value)
-                                       elog(ERROR, "--%s requires argument", optarg);
+                               {
+                                       if (flag == '-')
+                                               elog(ERROR, "--%s requires argument", optarg);
+                                       else
+                                               elog(ERROR, "-c %s requires argument", optarg);
+                               }
 
                                SetConfigOption(name, value, PGC_BACKEND);
                                free(name);
@@ -1639,7 +1646,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
        if (!IsUnderPostmaster)
        {
                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");
        }
 
        /*