11<!--
2- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.279 2005/08/12 18:23:53 tgl Exp $
2+ $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.280 2005/08/13 19:02:32 tgl Exp $
33PostgreSQL documentation
44-->
55
@@ -9064,6 +9064,9 @@ SELECT set_config('log_statement_stats', 'off', false);
90649064 <indexterm zone="functions-admin">
90659065 <primary>pg_reload_conf</primary>
90669066 </indexterm>
9067+ <indexterm zone="functions-admin">
9068+ <primary>pg_rotate_logfile</primary>
9069+ </indexterm>
90679070
90689071 <indexterm zone="functions-admin">
90699072 <primary>signal</primary>
@@ -9100,23 +9103,44 @@ SELECT set_config('log_statement_stats', 'off', false);
91009103 <entry><type>int</type></entry>
91019104 <entry>Cause server processes to reload their configuration files</entry>
91029105 </row>
9106+ <row>
9107+ <entry>
9108+ <literal><function>pg_rotate_logfile</function>()</literal>
9109+ </entry>
9110+ <entry><type>int</type></entry>
9111+ <entry>Rotate server's logfile</entry>
9112+ </row>
91039113 </tbody>
91049114 </tgroup>
91059115 </table>
91069116
91079117 <para>
9108- These functions return 1 if successful, 0 if not successful.
9109- The process ID (<literal>pid</literal>) of an active backend can be found
9110- from the <structfield>procpid</structfield> column in the
9111- <structname>pg_stat_activity</structname> view, or by listing the <command>postgres</command>
9112- processes on the server with <application>ps</>.
9118+ Each of these functions returns 1 if successful, 0 if not successful.
9119+ </para>
9120+
9121+ <para>
9122+ <function>pg_cancel_backend</> sends a Query Cancel (SIGINT) signal
9123+ to a backend process identified by process ID (<literal>pid</literal>).
9124+ The process ID of an active backend can be found from the
9125+ <structfield>procpid</structfield> column in the
9126+ <structname>pg_stat_activity</structname> view, or by listing the
9127+ <command>postgres</command> processes on the server with
9128+ <application>ps</>.
91139129 </para>
9130+
91149131 <para>
91159132 <function>pg_reload_conf</> sends a SIGHUP signal to the
91169133 postmaster, causing reload of the configuration files
91179134 in all server processes.
91189135 </para>
91199136
9137+ <para>
9138+ <function>pg_rotate_logfile</> signals the logfile manager to switch
9139+ to a new output file immediately. This works only when
9140+ <varname>redirect_stderr</> is used for logging, since otherwise there
9141+ is no logfile manager subprocess.
9142+ </para>
9143+
91209144 <indexterm zone="functions-admin">
91219145 <primary>pg_start_backup</primary>
91229146 </indexterm>
@@ -9341,22 +9365,9 @@ SELECT set_config('log_statement_stats', 'off', false);
93419365 </thead>
93429366
93439367 <tbody>
9344- <row>
9345- <entry>
9346- <literal><function>pg_file_length</function>(<parameter>filename</> <type>text</>)</literal>
9347- <indexterm zone="functions-admin">
9348- <primary>pg_file_length</primary>
9349- </indexterm>
9350- </entry>
9351- <entry><type>int8</type></entry>
9352- <entry>Return the file length</entry>
9353- </row>
93549368 <row>
93559369 <entry>
93569370 <literal><function>pg_ls_dir</function>(<parameter>dirname</> <type>text</>)</literal>
9357- <indexterm zone="functions-admin">
9358- <primary>pg_ls_dir</primary>
9359- </indexterm>
93609371 </entry>
93619372 <entry><type>setof text</type></entry>
93629373 <entry>List the contents of a directory</entry>
@@ -9373,69 +9384,45 @@ SELECT set_config('log_statement_stats', 'off', false);
93739384 <literal><function>pg_stat_file</function>(<parameter>filename</> <type>text</>)</literal>
93749385 </entry>
93759386 <entry><type>record</type></entry>
9376- <entry>Return information aboutthe file</entry>
9387+ <entry>Return information abouta file</entry>
93779388 </row>
93789389 </tbody>
93799390 </tgroup>
93809391 </table>
93819392
9393+ <indexterm zone="functions-admin">
9394+ <primary>pg_ls_dir</primary>
9395+ </indexterm>
9396+ <para>
9397+ <function>pg_ls_dir()</> returns all the names in the specified
9398+ directory, except the special entries <quote><literal>.</></> and
9399+ <quote><literal>..</></>.
9400+ </para>
9401+
93829402 <indexterm zone="functions-admin">
93839403 <primary>pg_read_file</primary>
93849404 </indexterm>
93859405 <para>
9386- <function>pg_read_file()</> returns part of atextfile , starting
9387- at the given offset, returning at most length bytes (less if the
9388- end of file is reached first). If offset is negative,
9389- it is relative to the end of the file.
9406+ <function>pg_read_file()</> returns part of atext file , starting
9407+ at the given<parameter> offset</> , returning at most<parameter> length</>
9408+ bytes (less if the end of file is reached first). If<parameter> offset</>
9409+ is negative, it is relative to the end of the file.
93909410 </para>
93919411
93929412 <indexterm zone="functions-admin">
93939413 <primary>pg_stat_file</primary>
93949414 </indexterm>
93959415 <para>
9396- <function>pg_stat_file()</> returns a record containing the
9416+ <function>pg_stat_file()</> returns a record containing the file
93979417 length, last accessed timestamp, last modified timestamp,
9398- creation timestamp, and aflag indicating if it is a directory.
9399- Use it like this :
9418+ creation timestamp, and aboolean indicating if it is a directory.
9419+ Typical usages include :
94009420<programlisting>
9401- SELECT *
9402- FROM pg_stat_file('filename')
9403- AS s(length int8, atime timestamptz, mtime timestamptz,
9404- ctime timestamptz, isdir bool);
9421+ SELECT * FROM pg_stat_file('filename');
9422+ SELECT (pg_stat_file('filename')).mtime;
94059423</programlisting>
94069424 </para>
94079425
9408- <para>
9409- The function shown in <xref
9410- linkend="functions-admin-logfile"> forces the server
9411- logfile to be rotated. This works only when <varname>redirect_stderr</>
9412- is used for logging. Use of this function is restricted
9413- to superusers.
9414- </para>
9415-
9416- <table id="functions-admin-logfile">
9417- <title>Server Logfile Functions</title>
9418- <tgroup cols="3">
9419- <thead>
9420- <row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
9421- </row>
9422- </thead>
9423-
9424- <tbody>
9425- <row>
9426- <entry>
9427- <literal><function>pg_rotate_logfile</function>()</literal>
9428- <indexterm zone="functions-admin">
9429- <primary>pg_rotate_logfile</primary>
9430- </indexterm>
9431- </entry>
9432- <entry><type>int</type></entry>
9433- <entry>Rotate server's logfile</entry>
9434- </row>
9435- </tbody>
9436- </tgroup>
9437- </table>
9438-
94399426 </sect1>
94409427</chapter>
94419428