Commit eeb21891 authored by Tom Lane's avatar Tom Lane

Fix erroneous implementation of -s in postmaster.c (the switch doesn't take

an optarg).  Add some comments noting that code in three different files has
to be kept in sync.  Fix erroneous description of -S switch (it sets work_mem
not silent_mode), and do some light copy-editing elsewhere in postgres-ref.
parent d6061d2f
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/postgres-ref.sgml,v 1.47 2006/06/18 15:38:36 petere Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/postgres-ref.sgml,v 1.48 2007/01/04 00:57:51 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -51,15 +51,14 @@ PostgreSQL documentation ...@@ -51,15 +51,14 @@ PostgreSQL documentation
<option>-D</option> option or the <envar>PGDATA</envar> environment <option>-D</option> option or the <envar>PGDATA</envar> environment
variable; there is no default. Typically, <option>-D</option> or variable; there is no default. Typically, <option>-D</option> or
<envar>PGDATA</envar> points directly to the data area directory <envar>PGDATA</envar> points directly to the data area directory
created by <application>initdb</>. Other possible file layouts are created by <xref linkend="app-initdb">. Other possible file layouts are
discussed in <xref linkend="runtime-config-file-locations">. A discussed in <xref linkend="runtime-config-file-locations">.
data area is created with <xref linkend="app-initdb">.
</para> </para>
<para> <para>
By default <command>postgres</command> starts in the By default <command>postgres</command> starts in the
foreground and prints log messages to the standard error stream. In foreground and prints log messages to the standard error stream. In
practical applications the <command>postgres</command> practical applications <command>postgres</command>
should be started as a background process, perhaps at boot time. should be started as a background process, perhaps at boot time.
</para> </para>
...@@ -67,18 +66,18 @@ PostgreSQL documentation ...@@ -67,18 +66,18 @@ PostgreSQL documentation
The <command>postgres</command> command can also be called in The <command>postgres</command> command can also be called in
single-user mode. The primary use for this mode is during single-user mode. The primary use for this mode is during
bootstrapping by <xref linkend="app-initdb">. Sometimes it is used bootstrapping by <xref linkend="app-initdb">. Sometimes it is used
for debugging or disaster recovery. When invoked in interactive for debugging or disaster recovery (but note that running a single-user
server is not truly suitable for debugging the server, since no
realistic interprocess communication and locking will happen).
When invoked in single-user
mode from the shell, the user can enter queries and the results mode from the shell, the user can enter queries and the results
will be printed to the screen, but in a form that is more useful will be printed to the screen, but in a form that is more useful
for developers than end users. But note that running a single-user for developers than end users. In the single-user mode,
server is not truly suitable for debugging the server since no the session user will be set to the user with ID 1, and implicit
realistic interprocess communication and locking will happen. When superuser powers are granted to this user.
running a stand-alone server, the session user will be set to the This user does not actually have to exist, so the single-user mode
user with ID 1. This user does not actually have to exist, so a can be used to manually recover from certain
stand-alone server can be used to manually recover from certain kinds of accidental damage to the system catalogs.
kinds of accidental damage to the system catalogs. Implicit
superuser powers are granted to the user with ID 1 in single-user
mode.
</para> </para>
</refsect1> </refsect1>
...@@ -118,10 +117,10 @@ PostgreSQL documentation ...@@ -118,10 +117,10 @@ PostgreSQL documentation
<term><option>-B <replaceable class="parameter">nbuffers</replaceable></option></term> <term><option>-B <replaceable class="parameter">nbuffers</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Sets the number of shared buffers for use by the server Sets the number of shared buffers for use by the server
processes. The default value of this parameter is chosen processes. The default value of this parameter is chosen
automatically by <application>initdb</application>; refer to <xref automatically by <application>initdb</application>; refer to <xref
linkend="runtime-config-resource-memory"> for more information. linkend="runtime-config-resource-memory"> for more information.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -148,7 +147,7 @@ PostgreSQL documentation ...@@ -148,7 +147,7 @@ PostgreSQL documentation
debugging output is written to the server log. Values are debugging output is written to the server log. Values are
from 1 to 5. It is also possible to pass <literal>-d from 1 to 5. It is also possible to pass <literal>-d
0</literal> for a specific session, which will prevent the 0</literal> for a specific session, which will prevent the
server log level of the <command>postgres</> from being server log level of the parent <command>postgres</> process from being
propagated to this session. propagated to this session.
</para> </para>
</listitem> </listitem>
...@@ -170,9 +169,9 @@ PostgreSQL documentation ...@@ -170,9 +169,9 @@ PostgreSQL documentation
<listitem> <listitem>
<para> <para>
Sets the default date style to <quote>European</quote>, that is Sets the default date style to <quote>European</quote>, that is
<literal>DMY</> ordering of input date fields. This also causes <literal>DMY</> ordering of input date fields. This also causes
the day to be printed before the month in certain date output formats. the day to be printed before the month in certain date output formats.
See <xref linkend="datatype-datetime"> for more information. See <xref linkend="datatype-datetime"> for more information.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -187,11 +186,6 @@ PostgreSQL documentation ...@@ -187,11 +186,6 @@ PostgreSQL documentation
disabling the <xref linkend="guc-fsync"> configuration disabling the <xref linkend="guc-fsync"> configuration
parameter. Read the detailed documentation before using this! parameter. Read the detailed documentation before using this!
</para> </para>
<para>
<option>--fsync=true</option> has the opposite effect
of this option.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -206,7 +200,7 @@ PostgreSQL documentation ...@@ -206,7 +200,7 @@ PostgreSQL documentation
listening on all available interfaces. An empty value listening on all available interfaces. An empty value
specifies not listening on any IP addresses, in which case specifies not listening on any IP addresses, in which case
only Unix-domain sockets can be used to connect to the only Unix-domain sockets can be used to connect to the
<command>postgres</command>. Defaults to listening only on server. Defaults to listening only on
<systemitem class="systemname">localhost</systemitem>. <systemitem class="systemname">localhost</systemitem>.
Specifying this option is equivalent to setting the <xref Specifying this option is equivalent to setting the <xref
linkend="guc-listen-addresses"> configuration parameter. linkend="guc-listen-addresses"> configuration parameter.
...@@ -236,10 +230,10 @@ PostgreSQL documentation ...@@ -236,10 +230,10 @@ PostgreSQL documentation
<term><option>-k <replaceable class="parameter">directory</replaceable></option></term> <term><option>-k <replaceable class="parameter">directory</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Specifies the directory of the Unix-domain socket on which Specifies the directory of the Unix-domain socket on which
<command>postgres</command> is to listen for <command>postgres</command> is to listen for
connections from client applications. The default is normally connections from client applications. The default is normally
<filename>/tmp</filename>, but can be changed at build time. <filename>/tmp</filename>, but can be changed at build time.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -248,11 +242,11 @@ PostgreSQL documentation ...@@ -248,11 +242,11 @@ PostgreSQL documentation
<term><option>-l</option></term> <term><option>-l</option></term>
<listitem> <listitem>
<para> <para>
Enables secure connections using <acronym>SSL</acronym>. Enables secure connections using <acronym>SSL</acronym>.
<productname>PostgreSQL</productname> must have been compiled with <productname>PostgreSQL</productname> must have been compiled with
support for <acronym>SSL</acronym> for this option to be support for <acronym>SSL</acronym> for this option to be
available. For more information on using <acronym>SSL</acronym>, available. For more information on using <acronym>SSL</acronym>,
refer to <xref linkend="ssl-tcp">. refer to <xref linkend="ssl-tcp">.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -261,15 +255,15 @@ PostgreSQL documentation ...@@ -261,15 +255,15 @@ PostgreSQL documentation
<term><option>-N <replaceable class="parameter">max-connections</replaceable></option></term> <term><option>-N <replaceable class="parameter">max-connections</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Sets the maximum number of client connections that this Sets the maximum number of client connections that this
<command>postgres</command> will accept. By server will accept. By
default, this value is 32, but it can be set as high as your default, this value is 32, but it can be set as high as your
system will support. (Note that system will support. (Note that
<option>-B</option> is required to be at least twice <option>-B</option> is required to be at least twice
<option>-N</option>. See <xref linkend="kernel-resources"> for a discussion of <option>-N</option>. See <xref linkend="kernel-resources"> for a discussion of
system resource requirements for large numbers of client system resource requirements for large numbers of client
connections.) Specifying this option is equivalent to setting the connections.) Specifying this option is equivalent to setting the
<xref linkend="guc-max-connections"> configuration parameter. <xref linkend="guc-max-connections"> configuration parameter.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -278,17 +272,17 @@ PostgreSQL documentation ...@@ -278,17 +272,17 @@ PostgreSQL documentation
<term><option>-o <replaceable class="parameter">extra-options</replaceable></option></term> <term><option>-o <replaceable class="parameter">extra-options</replaceable></option></term>
<listitem> <listitem>
<para> <para>
The command line-style options specified in <replaceable The command line-style options specified in <replaceable
class="parameter">extra-options</replaceable> are passed to class="parameter">extra-options</replaceable> are passed to
all server processes started by this all server processes started by this
<command>postgres</command>. If the option string contains <command>postgres</command> process. If the option string contains
any spaces, the entire string must be quoted. any spaces, the entire string must be quoted.
</para> </para>
<para> <para>
The use of this option is obsolete; all command-line options The use of this option is obsolete; all command-line options
for server processes can be specified directly on the for server processes can be specified directly on the
<command>postgres</command> command line <command>postgres</command> command line.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -297,15 +291,15 @@ PostgreSQL documentation ...@@ -297,15 +291,15 @@ PostgreSQL documentation
<term><option>-p <replaceable class="parameter">port</replaceable></option></term> <term><option>-p <replaceable class="parameter">port</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Specifies the TCP/IP port or local Unix domain socket file Specifies the TCP/IP port or local Unix domain socket file
extension on which <command>postgres</command> extension on which <command>postgres</command>
is to listen for connections from client applications. is to listen for connections from client applications.
Defaults to the value of the <envar>PGPORT</envar> environment Defaults to the value of the <envar>PGPORT</envar> environment
variable, or if <envar>PGPORT</envar> is not set, then variable, or if <envar>PGPORT</envar> is not set, then
defaults to the value established during compilation (normally defaults to the value established during compilation (normally
5432). If you specify a port other than the default port, 5432). If you specify a port other than the default port,
then all client applications must specify the same port using then all client applications must specify the same port using
either command-line options or <envar>PGPORT</envar>. either command-line options or <envar>PGPORT</envar>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -314,32 +308,21 @@ PostgreSQL documentation ...@@ -314,32 +308,21 @@ PostgreSQL documentation
<term><option>-s</option></term> <term><option>-s</option></term>
<listitem> <listitem>
<para> <para>
Print time information and other statistics at the end of each command. Print time information and other statistics at the end of each command.
This is useful for benchmarking or for use in tuning the number of This is useful for benchmarking or for use in tuning the number of
buffers. buffers.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-S</option></term> <term><option>-S</option> <replaceable class="parameter">work-mem</replaceable></term>
<listitem> <listitem>
<para> <para>
Specifies that the <command>postgres</command> Specifies the amount of memory to be used by internal sorts and hashes
process should start up in silent mode. That is, it will before resorting to temporary disk files. See the description of the
disassociate from the user's (controlling) terminal, start its <varname>work_mem</> configuration parameter in <xref
own process group, and redirect its standard output and linkend="runtime-config-resource-memory">.
standard error to <filename>/dev/null</filename>.
</para>
<para>
Using this switch discards all logging output, which is
probably not what you want, since it makes it very difficult
to troubleshoot problems. See below for a better way to start
<command>postgres</command> in the background.
</para>
<para>
<option>--silent-mode=false</option> has the opposite effect
of this option.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -385,13 +368,13 @@ PostgreSQL documentation ...@@ -385,13 +368,13 @@ PostgreSQL documentation
<term><option>-f</option> <literal>{ s | i | m | n | h }</literal></term> <term><option>-f</option> <literal>{ s | i | m | n | h }</literal></term>
<listitem> <listitem>
<para> <para>
Forbids the use of particular scan and join methods: Forbids the use of particular scan and join methods:
<literal>s</literal> and <literal>i</literal> <literal>s</literal> and <literal>i</literal>
disable sequential and index scans respectively, while disable sequential and index scans respectively, while
<literal>n</literal>, <literal>m</literal>, and <literal>h</literal> <literal>n</literal>, <literal>m</literal>, and <literal>h</literal>
disable nested-loop, merge and hash joins respectively. disable nested-loop, merge and hash joins respectively.
</para> </para>
<para> <para>
Neither sequential scans nor nested-loop joins can be disabled Neither sequential scans nor nested-loop joins can be disabled
completely; the <literal>-fs</literal> and completely; the <literal>-fs</literal> and
...@@ -423,8 +406,8 @@ PostgreSQL documentation ...@@ -423,8 +406,8 @@ PostgreSQL documentation
<term><option>-O</option></term> <term><option>-O</option></term>
<listitem> <listitem>
<para> <para>
Allows the structure of system tables to be modified. This is Allows the structure of system tables to be modified. This is
used by <command>initdb</command>. used by <command>initdb</command>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -433,9 +416,9 @@ PostgreSQL documentation ...@@ -433,9 +416,9 @@ PostgreSQL documentation
<term><option>-P</option></term> <term><option>-P</option></term>
<listitem> <listitem>
<para> <para>
Ignore system indexes when reading system tables (but still update Ignore system indexes when reading system tables (but still update
the indexes when modifying the tables). This is useful when the indexes when modifying the tables). This is useful when
recovering from damaged system indexes. recovering from damaged system indexes.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -444,9 +427,9 @@ PostgreSQL documentation ...@@ -444,9 +427,9 @@ PostgreSQL documentation
<term><option>-t</option> <literal>pa[rser] | pl[anner] | e[xecutor]</literal></term> <term><option>-t</option> <literal>pa[rser] | pl[anner] | e[xecutor]</literal></term>
<listitem> <listitem>
<para> <para>
Print timing statistics for each query relating to each of the Print timing statistics for each query relating to each of the
major system modules. This option cannot be used together major system modules. This option cannot be used together
with the <option>-s</option> option. with the <option>-s</option> option.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -474,9 +457,9 @@ PostgreSQL documentation ...@@ -474,9 +457,9 @@ PostgreSQL documentation
<term><option>-v</option> <replaceable class="parameter">protocol</replaceable></term> <term><option>-v</option> <replaceable class="parameter">protocol</replaceable></term>
<listitem> <listitem>
<para> <para>
Specifies the version number of the frontend/backend protocol Specifies the version number of the frontend/backend protocol
to be used for a particular session. This option is for to be used for a particular session. This option is for
internal use only. internal use only.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -497,9 +480,9 @@ PostgreSQL documentation ...@@ -497,9 +480,9 @@ PostgreSQL documentation
<term><option>-y</option> <replaceable class="parameter">database</replaceable></term> <term><option>-y</option> <replaceable class="parameter">database</replaceable></term>
<listitem> <listitem>
<para> <para>
Indicates that this is a subprocess started by Indicates that this is a subprocess started by a parent
<command>postgres</command> and specifies the database to <command>postgres</command> process, and specifies the database to
use. This option is for internal use only. use. This option is for internal use only.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -518,8 +501,8 @@ PostgreSQL documentation ...@@ -518,8 +501,8 @@ PostgreSQL documentation
<term><option>--single</option></term> <term><option>--single</option></term>
<listitem> <listitem>
<para> <para>
Selects the single-user mode. This must be the first argument Selects the single-user mode. This must be the first argument
on the command line. on the command line.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -528,8 +511,8 @@ PostgreSQL documentation ...@@ -528,8 +511,8 @@ PostgreSQL documentation
<term><replaceable class="parameter">database</replaceable></term> <term><replaceable class="parameter">database</replaceable></term>
<listitem> <listitem>
<para> <para>
Specifies the name of the database to be accessed. If it is Specifies the name of the database to be accessed. If it is
omitted it defaults to the user name. omitted it defaults to the user name.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -538,7 +521,7 @@ PostgreSQL documentation ...@@ -538,7 +521,7 @@ PostgreSQL documentation
<term><option>-E</option></term> <term><option>-E</option></term>
<listitem> <listitem>
<para> <para>
Echo all commands. Echo all commands.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -547,7 +530,7 @@ PostgreSQL documentation ...@@ -547,7 +530,7 @@ PostgreSQL documentation
<term><option>-j</option></term> <term><option>-j</option></term>
<listitem> <listitem>
<para> <para>
Disables use of newline as a statement delimiter. Disables use of newline as a statement delimiter.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -556,10 +539,10 @@ PostgreSQL documentation ...@@ -556,10 +539,10 @@ PostgreSQL documentation
<term><option>-r</option> <replaceable class="parameter">filename</replaceable></term> <term><option>-r</option> <replaceable class="parameter">filename</replaceable></term>
<listitem> <listitem>
<para> <para>
Send all server log output to <replaceable Send all server log output to <replaceable
class="parameter">filename</replaceable>. In normal multiuser class="parameter">filename</replaceable>. In normal multiuser
mode, this option is ignored, and <systemitem>stderr</> is mode, this option is ignored, and <systemitem>stderr</> is
used by all processes. used by all processes.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -795,8 +778,7 @@ PostgreSQL documentation ...@@ -795,8 +778,7 @@ PostgreSQL documentation
</screen> </screen>
This command will start up <command>postgres</command> This command will start up <command>postgres</command>
communicating through the port 1234. In order to connect to this communicating through the port 1234. In order to connect to this
<command>postgres</command> using <application>psql</>, you would need to server using <application>psql</>, you would need to run it as
run it as
<screen> <screen>
<prompt>$</prompt> <userinput>psql -p 1234</userinput> <prompt>$</prompt> <userinput>psql -p 1234</userinput>
</screen> </screen>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.105 2006/10/04 00:29:53 momjian Exp $ * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.106 2007/01/04 00:57:51 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -258,7 +258,10 @@ startup_hacks(const char *progname) ...@@ -258,7 +258,10 @@ startup_hacks(const char *progname)
} }
/*
* Help display should match the options accepted by PostmasterMain()
* and PostgresMain().
*/
static void static void
help(const char *progname) help(const char *progname)
{ {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.505 2006/11/30 18:29:12 tgl Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.506 2007/01/04 00:57:51 tgl Exp $
* *
* NOTES * NOTES
* *
...@@ -415,6 +415,11 @@ PostmasterMain(int argc, char *argv[]) ...@@ -415,6 +415,11 @@ PostmasterMain(int argc, char *argv[])
opterr = 1; opterr = 1;
/*
* Parse command-line options. CAUTION: keep this in sync with
* tcop/postgres.c (the option sets should not conflict)
* and with the common help() function in main/main.c.
*/
while ((opt = getopt(argc, argv, "A:B:c:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:W:-:")) != -1) while ((opt = getopt(argc, argv, "A:B:c:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:W:-:")) != -1)
{ {
switch (opt) switch (opt)
...@@ -513,7 +518,7 @@ PostmasterMain(int argc, char *argv[]) ...@@ -513,7 +518,7 @@ PostmasterMain(int argc, char *argv[])
break; break;
case 's': case 's':
SetConfigOption("log_statement_stats", optarg, PGC_POSTMASTER, PGC_S_ARGV); SetConfigOption("log_statement_stats", "true", PGC_POSTMASTER, PGC_S_ARGV);
break; break;
case 'T': case 'T':
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.519 2006/12/08 02:15:07 neilc Exp $ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.520 2007/01/04 00:57:51 tgl Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -2756,6 +2756,11 @@ PostgresMain(int argc, char *argv[], const char *username) ...@@ -2756,6 +2756,11 @@ PostgresMain(int argc, char *argv[], const char *username)
ctx = PGC_POSTMASTER; ctx = PGC_POSTMASTER;
gucsource = PGC_S_ARGV; /* initial switches came from command line */ gucsource = PGC_S_ARGV; /* initial switches came from command line */
/*
* Parse command-line options. CAUTION: keep this in sync with
* postmaster/postmaster.c (the option sets should not conflict)
* and with the common help() function in main/main.c.
*/
while ((flag = getopt(argc, argv, "A:B:c:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:y:-:")) != -1) while ((flag = getopt(argc, argv, "A:B:c:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:y:-:")) != -1)
{ {
switch (flag) switch (flag)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment