mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Switch over to using the src/timezone functions for formatting timestamps
displayed in the postmaster log. This avoids Windows-specific problems with localized time zone names that are in the wrong encoding, and generally seems like a good idea to forestall other potential platform-dependent issues. To preserve the existing behavior that all backends will log in the same time zone, create a new GUC variable log_timezone that can only be changed on a system-wide basis, and reference log-related calculations to that zone instead of the TimeZone variable. This fixes the issue reported by Hiroshi Saito that timestamps printed by xlog.c startup could be improperly localized on Windows. We still need a simpler patch for that problem in the back branches, however.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.135 2007/08/02 23:39:43 adunstan Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.136 2007/08/04 01:26:53 tgl Exp $ -->
|
||||
|
||||
<chapter Id="runtime-config">
|
||||
<title>Server Configuration</title>
|
||||
@ -2311,13 +2311,15 @@ SELECT * FROM parent WHERE key = 2400;
|
||||
When <varname>redirect_stderr</varname> is enabled, this parameter
|
||||
sets the file names of the created log files. The value
|
||||
is treated as a <systemitem>strftime</systemitem> pattern,
|
||||
so <literal>%</literal>-escapes
|
||||
can be used to specify time-varying file names.
|
||||
so <literal>%</literal>-escapes can be used to specify time-varying
|
||||
file names. (Note that if there are
|
||||
any time-zone-dependent <literal>%</literal>-escapes, the computation
|
||||
is done in the zone specified by <xref linkend="guc-log-timezone">.)
|
||||
If no <literal>%</literal>-escapes are present,
|
||||
<productname>PostgreSQL</productname> will
|
||||
append the epoch of the new log file's open time. For example,
|
||||
if <varname>log_filename</varname> were <literal>server_log</literal>, then the
|
||||
chosen file name would be <literal>server_log.1093827753</literal>
|
||||
<productname>PostgreSQL</productname> will append the epoch of the new
|
||||
log file's creation time. For example, if
|
||||
<varname>log_filename</varname> were <literal>server_log</literal>,
|
||||
then the chosen file name would be <literal>server_log.1093827753</>
|
||||
for a log starting at Sun Aug 29 19:02:33 2004 MST.
|
||||
This parameter can only be set in the <filename>postgresql.conf</>
|
||||
file or on the server command line.
|
||||
@ -2884,7 +2886,7 @@ SELECT * FROM parent WHERE key = 2400;
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%t</literal></entry>
|
||||
<entry>Time stamp without milliseconds (no timezone either on Windows)</entry>
|
||||
<entry>Time stamp without milliseconds</entry>
|
||||
<entry>no</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -2909,7 +2911,7 @@ SELECT * FROM parent WHERE key = 2400;
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>%s</literal></entry>
|
||||
<entry>Session start time stamp</entry>
|
||||
<entry>Process start time stamp</entry>
|
||||
<entry>no</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -2935,7 +2937,7 @@ SELECT * FROM parent WHERE key = 2400;
|
||||
|
||||
The <literal>%c</> escape prints a quasi-unique session identifier,
|
||||
consisting of two 4-byte hexadecimal numbers (without leading zeros)
|
||||
separated by a dot. The numbers are the session start time and the
|
||||
separated by a dot. The numbers are the process start time and the
|
||||
process ID, so <literal>%c</> can also be used as a space saving way
|
||||
of printing those items.
|
||||
</para>
|
||||
@ -3036,6 +3038,25 @@ SELECT * FROM parent WHERE key = 2400;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="guc-log-timezone" xreflabel="log_timezone">
|
||||
<term><varname>log_timezone</varname> (<type>string</type>)</term>
|
||||
<indexterm>
|
||||
<primary><varname>log_timezone</> configuration parameter</primary>
|
||||
</indexterm>
|
||||
<listitem>
|
||||
<para>
|
||||
Sets the time zone used for timestamps written in the log.
|
||||
Unlike <xref linkend="guc-timezone">, this value is cluster-wide,
|
||||
so that all sessions will report timestamps consistently.
|
||||
The default is <literal>unknown</>, which means to use whatever
|
||||
the system environment specifies as the time zone. See <xref
|
||||
linkend="datatype-timezones"> for more information.
|
||||
This parameter can only be set in the <filename>postgresql.conf</>
|
||||
file or on the server command line.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</sect2>
|
||||
</sect1>
|
||||
@ -3822,9 +3843,9 @@ SET XML OPTION { DOCUMENT | CONTENT };
|
||||
<listitem>
|
||||
<para>
|
||||
Sets the time zone for displaying and interpreting time stamps.
|
||||
The default is <literal>'unknown'</>, which means to use whatever
|
||||
The default is <literal>unknown</>, which means to use whatever
|
||||
the system environment specifies as the time zone. See <xref
|
||||
linkend="datatype-datetime"> for more
|
||||
linkend="datatype-timezones"> for more
|
||||
information.
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.205 2007/07/27 10:37:52 petere Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.206 2007/08/04 01:26:53 tgl Exp $ -->
|
||||
|
||||
<chapter id="datatype">
|
||||
<title id="datatype-title">Data Types</title>
|
||||
@ -2234,7 +2234,8 @@ January 8 04:05:06 1999 PST
|
||||
savings transition-date rules as well. The recognized abbreviations
|
||||
are listed in the <literal>pg_timezone_abbrevs</> view (see <xref
|
||||
linkend="view-pg-timezone-abbrevs">). You cannot set the
|
||||
configuration parameter <xref linkend="guc-timezone"> using a time
|
||||
configuration parameters <xref linkend="guc-timezone"> or
|
||||
<xref linkend="guc-log-timezone"> using a time
|
||||
zone abbreviation, but you can use abbreviations in
|
||||
date/time input values and with the <literal>AT TIME ZONE</>
|
||||
operator.
|
||||
@ -2316,6 +2317,8 @@ January 8 04:05:06 1999 PST
|
||||
behavior of the C library function <literal>localtime()</>. The
|
||||
default time zone is selected as the closest match among
|
||||
<productname>PostgreSQL</productname>'s known time zones.
|
||||
(These rules are also used to choose the default value of
|
||||
<xref linkend="guc-log-timezone">, if it is not specified.)
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
|
Reference in New Issue
Block a user