バージョンごとのドキュメント一覧

B.4. 日付/時刻設定ファイル #

<title>Date/Time Configuration Files</title>

Since timezone abbreviations are not well standardized, <productname>PostgreSQL</productname> provides a means to customize the set of abbreviations accepted by the server. The <xref linkend="guc-timezone-abbreviations"/> run-time parameter determines the active set of abbreviations. While this parameter can be altered by any database user, the possible values for it are under the control of the database administrator &mdash; they are in fact names of configuration files stored in <filename>.../share/timezonesets/</filename> of the installation directory. By adding or altering files in that directory, the administrator can set local policy for timezone abbreviations. 時間帯省略形は十分に標準化されていませんので、PostgreSQLでは、サーバで受付け可能な省略形群をカスタマイズできる仕組みを提供します。 timezone_abbreviations実行時パラメータは有効な省略形群を決定します。 このパラメータはすべてのデータベースユーザで変更可能ですが、取り得る値はデータベース管理者により制御されます。 これらは実際にはインストレーションディレクトリの.../share/timezonesets/内の設定ファイル名です。 代替ファイルをこのディレクトリに追加することにより、管理者は時間帯省略形に対するローカルポリシーを設定することができます。

<varname>timezone_abbreviations</varname> can be set to any file name found in <filename>.../share/timezonesets/</filename>, if the file's name is entirely alphabetic. (The prohibition against non-alphabetic characters in <varname>timezone_abbreviations</varname> prevents reading files outside the intended directory, as well as reading editor backup files and other extraneous files.) timezone_abbreviationsは、 .../share/timezonesets/に存在する、名前のすべてがアルファベットである任意のファイルの名前を指定することができます。 (timezone_abbreviations内の非アルファベット文字の禁止により、意図したディレクトリ以外のファイル読み取りを防ぐことができます。 また、バックアップファイルやその他のファイルの読み取りを防ぐこともできます。)

A timezone abbreviation file can contain blank lines and comments beginning with <literal>#</literal>. Non-comment lines must have one of these formats: 時間帯省略形ファイルには空白行や#から始まるコメントを含めることができます。 コメント以外は以下の書式を持たなければなりません。

zone_abbreviation offset
zone_abbreviation offset D
zone_abbreviation time_zone_name
@INCLUDE file_name
@OVERRIDE

A <replaceable>zone_abbreviation</replaceable> is just the abbreviation being defined. An <replaceable>offset</replaceable> is an integer giving the equivalent offset in seconds from UTC, positive being east from Greenwich and negative being west. For example, -18000 would be five hours west of Greenwich, or North American east coast standard time. <literal>D</literal> indicates that the zone name represents local daylight-savings time rather than standard time. zone_abbreviationは単なる定義された省略形です。 offsetはUTCからの相当するオフセットを秒数で表した整数です。 グリニッジより東にあれば正、西にあれば負の値となります。 たとえば、-18000はグリニッジより西に5時間、すなわち、北アメリカ東海岸の標準時間を示します。 Dは、時間帯名が標準時間ではなくローカル時間での夏時間を表すことを示します。

Alternatively, a <replaceable>time_zone_name</replaceable> can be given, referencing a zone name defined in the IANA timezone database. The zone's definition is consulted to see whether the abbreviation is or has been in use in that zone, and if so, the appropriate meaning is used &mdash; that is, the meaning that was currently in use at the timestamp whose value is being determined, or the meaning in use immediately before that if it wasn't current at that time, or the oldest meaning if it was used only after that time. This behavior is essential for dealing with abbreviations whose meaning has historically varied. It is also allowed to define an abbreviation in terms of a zone name in which that abbreviation does not appear; then using the abbreviation is just equivalent to writing out the zone name. あるいは、IANA時間帯データベースで定義されている地域名を参照するtime_zone_nameを指定することもできます。 地域の定義はその地域の省略形が存在するか、もしくは、使われてきたかを確認し、もしそうであれば、適切な意味として使われます。 適切な意味とは、確定した値を持つタイムスタンプが使われている意味、その当時は使われていなかったかもしれないが、後に即座に使われる意味、もしくは、その時の後にのみ使われる最も古い意味です。 この挙動は歴史的に変化した意味を持つ省略形を扱う際には不可欠です。 また、省略形が現れない地域名に関して省略形を定義することもできます。 この省略形を使うことは地域名を書き出すことと全く同じです。

ヒント

Using a simple integer <replaceable>offset</replaceable> is preferred when defining an abbreviation whose offset from UTC has never changed, as such abbreviations are much cheaper to process than those that require consulting a time zone definition. タイムゾーンの定義の参照が必要になる過程よりはるかに安価であるため、UTCからのオフセットが今までに一度も変わっていない省略形を扱う場合は、単純な整数型のoffsetを使う方が好ましいでしょう。

The <literal>@INCLUDE</literal> syntax allows inclusion of another file in the <filename>.../share/timezonesets/</filename> directory. Inclusion can be nested, to a limited depth. @INCLUDE構文により、.../share/timezonesets/ディレクトリ内の他のファイルを含有することができます。 深さに制限がありますが、入れ子に含有することができます。

The <literal>@OVERRIDE</literal> syntax indicates that subsequent entries in the file can override previous entries (typically, entries obtained from included files). Without this, conflicting definitions of the same timezone abbreviation are considered an error. @OVERRIDE構文は、ファイル内の続く項目が既存の項目(典型的には、インクルードされたファイルから得られた項目)を上書きできることを示します。 これがないと、同一時間帯省略形の定義が競合した場合にエラーとみなされます。

In an unmodified installation, the file <filename>Default</filename> contains all the non-conflicting time zone abbreviations for most of the world. Additional files <filename>Australia</filename> and <filename>India</filename> are provided for those regions: these files first include the <literal>Default</literal> file and then add or modify abbreviations as needed. 未変更のインストレーションでは、Defaultファイルに、ほとんど全世界の競合しない時間帯省略形をすべて記載しています。 さらにAustraliaおよびIndiaファイルがこれらの地区向けに提供されています。 これらのファイルはDefaultファイルの先頭で含有されています。 必要に応じて省略形の追加・変更を行ってください。

For reference purposes, a standard installation also contains files <filename>Africa.txt</filename>, <filename>America.txt</filename>, etc., containing information about every time zone abbreviation known to be in use according to the IANA timezone database. The zone name definitions found in these files can be copied and pasted into a custom configuration file as needed. Note that these files cannot be directly referenced as <varname>timezone_abbreviations</varname> settings, because of the dot embedded in their names. 参考のため、標準のインストレーションにはAfrica.txtAmerica.txtなども含まれています。 これらにはIANA時間帯データベースに従って使用されている時間帯省略形に関する情報がすべて含まれています。 これらのファイル内にある時間帯定義を必要に応じてコピーペーストして独自の設定ファイルを編集することができます。 これらのファイル名にドットが入っていますので、timezone_abbreviations設定から直接参照できないことに注意してください。

注記

If an error occurs while reading the time zone abbreviation set, no new value is applied and the old set is kept. If the error occurs while starting the database, startup fails. 時間帯省略形を読み込む時にエラーが発生した場合、新しい値は適用されず、古い値がそのまま残ります。 データベースの起動時にエラーが起きた場合は、起動に失敗します。

注意

Time zone abbreviations defined in the configuration file override non-timezone meanings built into <productname>PostgreSQL</productname>. For example, the <filename>Australia</filename> configuration file defines <literal>SAT</literal> (for South Australian Standard Time). When this file is active, <literal>SAT</literal> will not be recognized as an abbreviation for Saturday. 設定ファイル内で定義される時間帯省略形は、PostgreSQLに組み込み済みの時間帯以外の意味も変更します。 たとえば、Australia設定ファイルではSAT(南オーストラリア標準時間)を定義しています。 このファイルが有効な場合、SATは土曜の省略形として認識されなくなります。

注意

If you modify files in <filename>.../share/timezonesets/</filename>, it is up to you to make backups &mdash; a normal database dump will not include this directory. .../share/timezonesets/を変更する時にバックアップを責任を持って行ってください。 このディレクトリは通常のデータベースダンプに含まれません。