Home Explore Blog CI



postgresql

9th chunk of `doc/src/sgml/ref/postgres-ref.sgml`
c005352b2be9f355ce4e3acb008f30170a9537f7339b65390000000100000ba4
 the second will
   forcefully disconnect all clients, and the third will quit
   immediately without proper shutdown, resulting in a recovery run
   during restart.
  </para>

  <para>
   The <literal>SIGHUP</literal> signal will reload
   the server configuration files.  It is also possible to send
   <literal>SIGHUP</literal> to an individual server process, but that
   is usually not sensible.
  </para>

  <para>
   To cancel a running query, send the <literal>SIGINT</literal> signal
   to the process running that command. To terminate a backend process
   cleanly, send <literal>SIGTERM</literal> to that process. See
   also <function>pg_cancel_backend</function> and <function>pg_terminate_backend</function>
   in <xref linkend="functions-admin-signal"/> for the SQL-callable equivalents
   of these two actions.
  </para>

  <para>
   The <command>postgres</command> server uses <literal>SIGQUIT</literal>
   to tell subordinate server processes to terminate without normal
   cleanup.
   This signal <emphasis>should not</emphasis> be used by users.  It
   is also unwise to send <literal>SIGKILL</literal> to a server
   process &mdash; the main <command>postgres</command> process will
   interpret this as a crash and will force all the sibling processes
   to quit as part of its standard crash-recovery procedure.
  </para>
 </refsect1>

 <refsect1 id="app-postgres-bugs">
  <title>Bugs</title>
  <para>
   The <option>--</option> options will not work on <systemitem
   class="osname">FreeBSD</systemitem> or <systemitem class="osname">OpenBSD</systemitem>.
   Use <option>-c</option> instead. This is a bug in the affected operating
   systems; a future release of <productname>PostgreSQL</productname>
   will provide a workaround if this is not fixed.
  </para>
 </refsect1>

 <refsect1 id="app-postgres-single-user" xreflabel="Single-User Mode">
  <title>Single-User Mode</title>

   <para>
    To start a single-user mode server, use a command like
<screen>
<userinput>postgres --single -D /usr/local/pgsql/data <replaceable>other-options</replaceable> my_database</userinput>
</screen>
    Provide the correct path to the database directory with <option>-D</option>, or
    make sure that the environment variable <envar>PGDATA</envar> is set.
    Also specify the name of the particular database you want to work in.
   </para>

   <para>
    Normally, the single-user mode server treats newline as the command
    entry terminator; there is no intelligence about semicolons,
    as there is in <application>psql</application>.  To continue a command
    across multiple lines, you must type backslash just before each
    newline except the last one.  The backslash and adjacent newline are
    both dropped from the input command.  Note that this will happen even
    when within a string literal or comment.
   </para>

   <para>
    But if you use the <option>-j</option> command line switch, a single newline
    does not terminate command entry;

Title: Postgres Signal Handling, Bugs, and Single-User Mode
Summary
This section details signal handling in Postgres, including SIGTERM, SIGINT, SIGQUIT, and SIGHUP, and notes on avoiding SIGKILL. It explains the effects of each signal on server processes and clients. It also documents a bug on FreeBSD and OpenBSD with the '--' options and describes how to start and use Postgres in single-user mode.