SET

Name

SET  --  Set run-time parameters for session セッションにおける実行時パラメータを設定する。

Synopsis

SET variable { TO | = } { 'value' | DEFAULT }
SET TIME ZONE { 'timezone' | LOCAL | DEFAULT }
SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZED }
  

入力

variable

Settable global parameter.

設定可能なグローバルパラメータ。

value

New value of parameter.

パラメータに設定する値。

The possible variables and allowed values are:

設定可能な変数とそのとり得る値は次の通りです。

CLIENT_ENCODING | NAMES

Sets the multi-byte client encoding. Parameters are:

クライアント側のマルチバイト・コーディング方式を設定する。 値として以下のものがあります。

value

Sets the multi-byte client encoding to value. The specified encoding must be supported by the backend.

クライアント側のマルチバイト・コーディング方式をこの value に設定 します。指定するコーディング方式はバックエンドでサポートさ れたものでなければいけません。

DEFAULT

Sets the multi-byte client encoding to the default value.

クライアント側マルチバイト・コーディング方式をデフォルト値 に設定します。

This is only enabled if multi-byte was specified to configure.

このパラメータは、configure 時にマルチバイト機能を指定していた 場合にのみ使用できます。

DateStyle

Set the date/time representation style. Affects the output format, and in some cases it can affect the interpretation of input.

日付/時刻の表現形式を設定します。出力の書式に影響を与え、また、 入力の解釈にも影響を与えることもあります。

ISO

use ISO 8601-style dates and times

ISO 8601 形式の日付と時刻を使用します。

SQL

use Oracle/Ingres-style dates and times

Oracle/Ingres 形式の日付と時刻を使用します。

Postgres

use traditional Postgres format

従来からの Postgres 形式を使用し ます。

European

use dd/mm/yyyy for numeric date representations.

数値型の日付表現に dd/mm/yyyy を使用します。

NonEuropean

use mm/dd/yyyy for numeric date representations.

数値型の日付表現に mm/dd/yyyy を使用します。

German

use dd.mm.yyyy for numeric date representations.

数値型の日付表現に dd.mm.yyyy を使用します。

US

same as 'NonEuropean'

'NonEuropean' と同一です。

default

restores the default values ('US,Postgres')

デフォルト値( US,Postgres )に戻します。

Date format initialization may be done by:

日付形式は以下によって初期化されます。

Setting the PGDATESTYLE environment variable.
環境変数 PGDATESTYLE の設定。
Running postmaster using the -o -e option to set dates to the European convention. Note that this affects only the some combinations of date styles; for example the ISO style is not affected by this parameter.
日付を -o -e オプションで European 規定に設定して postmaster を起動し ます。これがある日付形式の組合せのみに影響を与えることに注意し て下さい。例えば、このパラメータは ISO 形式に影響を与えません。
Changing variables in src/backend/utils/init/globals.c.
src/backend/utils/init/globals.c 内の変数 の変更。

The variables in globals.c which can be changed are:

変更できる globals.c には以下のものがありま す。

bool EuroDates = false | true
int DateStyle = USE_ISO_DATES | USE_POSTGRES_DATES | USE_SQL_DATES | USE_GERMAN_DATES

SERVER_ENCODING

Sets the multi-byte server encoding

サーバ側のマルチバイト・コーディング方式を設定します。

Sets the multi-byte server encoding.

サーバ側のマルチバイト・コーディング方式を設定します。

DEFAULT

Sets the multi-byte server encoding.

サーバ側のマルチバイト・コーディング方式を設定します。 (訳注: サーバ側マルチバイト・コーディング方式をデフォルト 値に設定します。の間違いと思われます。)

This is only enabled if multi-byte was specified to configure.

このパラメータは、configure 時にマルチバイト機能を指定していた場 合にのみ使用できます。

TIMEZONE

The possible values for timezone depends on your operating system. For example on Linux /usr/lib/zoneinfo contains the database of timezones.

タイムゾーンに設定可能な値は使用しているオペレーティングシステ ムに依存します。例えば Linux では、タイムゾーンのデータベースは /usr/lib/zoneinfo にあります。

Here are some valid values for timezone:

タイムゾーン用に有効な値を数点示します。

'PST8PDT'

set the timezone for California

カリフォルニア用タイムゾーンに設定します。

'Portugal'

set time zone for Portugal.

ポルトガル用タイムゾーンに設定します。

'Europe/Rome'

set time zone for Italy.

イタリア用タイムゾーンに設定します。

DEFAULT

set time zone to your local timezone (value of the TZ environment variable).

使用しているシステムのローカルなタイムゾーン(環境変数 TZ の値)をタイムゾーンに設定します。

If an invalid time zone is specified, the time zone becomes GMT (on most systems anyway).

無効なタイムゾーンが指定された場合、タイムゾーンは(ほとんどの システムで、いいかげんながらも)GMT になります。

A frontend which uses libpq may be initialized by setting the PGTZ environment variable.

libpq を使ったフロントエンドでは、環境変数 PGTZ の設定によって 初期化できます。

The second syntax shown above, allows one to set the timezone with a syntax similar to SQL92 SET TIME ZONE. The LOCAL keyword is just an alternate form of DEFAULT for SQL92 compatibility.

上の 2 番目の構文では、SQL92 の SET TIME ZONE に似た構文でタイムゾーンの設定 ができます。キーワード LOCAL は SQL92 互換のために用意された、単 なる DEFAULT の別の形式です。

TRANSACTION ISOLATION LEVEL

Sets the isolation level for the current transaction.

現在のトランザクションの隔離レベルを設定します。

READ COMMITTED

The current transaction queries read only rows committed before a query began. READ COMMITTED is the default.

現在のトランザクションでの問い合わせは、問い合わせが始まる 前にコミットされた行のみを読みとります。READ COMMITTED がデ フォルトです。

Note: SQL92 standard requires SERIALIZABLE to be the default isolation level.

SQL92 標準では、SERIALIZABLE をデフォルト の隔離レベルとすることを要求しています。

SERIALIZABLE

The current transaction queries read only rows committed before first DML statement (SELECT/INSERT/DELETE/UPDATE/FETCH/COPY_TO) was executed in this transaction.

現在のトランザクションでの問い合わせは、そのトランザクショ ンで最初に行なわれる DML 文( SELECT/INSERT/DELETE/UPDATE/FETCH/COPY_TO )より前にコミットされた行のみを読みとります。

There are also several internal or optimization parameters which can be specified by the SET command:

SET コマンドで指定できるパラメータには、以下 のような内部使用、または、最適化用のものも幾つかあります。

COST_HEAP

Sets the default cost of a heap scan for use by the optimizer.

オブティマイザで使われるヒープスキャンのコストのデフォルト値を 設定します。

float4

Set the cost of a heap scan to the specified floating point value.

ヒープスキャンのコストを指定された浮動小数点値に設定します。

DEFAULT

Sets the cost of a heap scan to the default value.

ヒープスキャンのコストにデフォルト値を設定します。

The frontend may be initialized by setting the PGCOSTHEAP environment variable.

フロントエンドは、環境変数 PGCOSTHEAP を設定することでも初期化で きます。

COST_INDEX

Sets the default cost of an index scan for use by the optimizer.

オプティマイザで使われるインデックススキャンのデフォルト・コスト を設定します。

float4

Set the cost of an index scan to the specified floating point value.

インデックススキャンのコストを指定された浮動小数点値に設定します。

DEFAULT

Sets the cost of an index scan to the default value.

インデックススキャンのコストをデフォルト値に設定します。

The frontend may be initialized by setting the PGCOSTINDEX environment variable.

フロントエンドは、環境変数 PGCOSTINDEX を設定することでも初期化 できます。

GEQO

Sets the threshold for using the genetic optimizer algorithm.

遺伝的最適化アルゴリズムの使用に関する閾値を設定します。

ON

enables the genetic optimizer algorithm for statements with 6 or more tables.

6 個以上のテーブルを持つ文では、遺伝的最適化アルゴリズムが 有効になります。

ON=#

Takes an integer argument to enable the genetic optimizer algorithm for statements with # or more tables in the query.

引数として整数 # をとり、問い合わせ内に # 個以上のテーブル を持つ文で遺伝的最適化アルゴリズムを有効にします。

OFF

disables the genetic optimizer algorithm.

遺伝的最適化アルゴリズムを無効にします。

DEFAULT

Equivalent to specifying SET GEQO='ON'

SET GEQO='ON' の指定と同一です。

This algorithm is on by default, which used GEQO for statements of eleven or more tables. (See the chapter on GEQO in the Programmer's Guide for more information).

このアルゴリズムはデフォルトで有効で、11 個以上のテーブルを持つ 文に GEQO が使われます。(より詳しくは、プログラマガイドの GEQO の章を参照して下さい。)

The frontend may be initialized by setting PGGEQO environment variable.

フロントエンドでは、環境変数 PGGEQO を設定することでも初期化するこ とができます

It may be useful when joining big relations with small ones. This algorithm is off by default. It's not used by GEQO anyway.

大規模な(複数)リレーションと小規模な(複数)リレーションを結 合する際に有益です。このアルゴリズムはデフォルトで無効です。 GEQO を全く使用しません。 上と言っていることが異なってましたので、ソースを参照。 ./backend/optimizer/path/allpaths.c と ./include/config.h を見ると、 有効、11 個がデフォルトのようです。 (訳注: この段落は単なる間違いと思われます。)

KSQO

Key Set Query Optimizer forces the query optimizer to optimize repetative OR clauses such as generated by MicroSoft Access:

キーセット・クエリオブティマイザは、問い 合わせオブティマイザを強制的に、 MicroSoft Access で生成されるような OR 句の繰り返しに最適化します。

ON

enables this optimization.

この最適化を有効にします。

OFF

disables this optimization.

この最適化を無効にします。

DEFAULT

Equivalent to specifying SET KSQO='OFF'.

SET KSQO='OFF'の指定と同一です。

It may be useful when joining big relations with small ones. This algorithm is off by default. It's not used by GEQO anyway.

大規模な(複数)リレーションと小規模な(複数)リレーションを結 合する際に有益です。このアルゴリズムはデフォルトで無効です。 GEQO を全く使用しません。 (訳注: この段落は単なる間違いと思われます。)

The frontend may be initialized by setting the PGKSQO environment variable.

フロントエンドでは、環境変数 PGKSQO を設定することでも初期化する ことができます

出力

SET VARIABLE

Message returned if successfully.

成功した時に返されるメッセージ。

WARN: Bad value for variable (value)

If the command fails to set the specified variable.

指定した変数の設定に失敗した場合。

説明

SET will modify configuration parameters for variable during a session.

SET はあるセッションにおける引数 variable の設定 パラメータを変更します。

Current values can be obtained using SHOW, and values can be restored to the defaults using RESET. Parameters and values are case-insensitive. Note that the value field is always specified as a string, so is enclosed in single-quotes.

現在の値は SHOW を使って入手でき、また、その値 は RESET を使ってデフォルト値に戻すことができ ます。パラメータ名と値は大文字小文字を区別しません。値のフィール ドは常に文字列として指定する、つまり、シングルクォートで括られて いることに注意して下さい。

SET TIME ZONE changes the session's default time zone offset. An SQL-session always begins with an initial default time zone offset. The SET TIME ZONE statement is used to change the default time zone offset for the current SQL session.

SET TIME ZONE はそのセッションにおけるタイムゾー ンのデフォルトオフセットを変更します。1 つの SQL セッションは常に初 期のデフォルトタイムゾーンを持って始まります。 SET TIME ZONE 文は、現在の SQL セッション用のタイ ムゾーンのデフォルトオフセットを変更することに使われます。

注意

The SET variable statement is a Postgres language extension.

SET variable 文は、Postgres の拡張言語です。

Refer to SHOW and RESET to display or reset the current values.

現在の値の表示/リセットについては SHOWRESETを参照して下さい。

使用法

Set the style of date to ISO:

日付の形式を ISO に設定します。

   SET DATESTYLE TO 'ISO';
   
Enable GEQO for queries with 4 or more tables: 4 個以上のテーブルを持つ問い合わせに対して GEQO を有効にします。
 
   SET GEQO ON=4;
   
Set GEQO to default: GEQO をデフォルト値に戻します。
 
   SET GEQO = DEFAULT;
   
Set the timezone for Berkeley, California: カリフォルニア、バークレイ用のタイムゾーンに設定します。
 
   SET TIME ZONE 'PST8PDT';
   SELECT CURRENT_TIMESTAMP AS today;
   
   today
   ----------------------
   1998-03-31 07:41:21-08
   
Set the timezone for Italy: イタリア用のタイムゾーンに設定します。
 
   SET TIME ZONE 'Europe/Rome';
   SELECT CURRENT_TIMESTAMP AS today;
   
   today
   ----------------------
   1998-03-31 17:41:31+02
   

互換性

SQL92

There is no SET variable in SQL92 (except for SET TRANSACTION ISOLATION LEVEL). The SQL92 syntax for SET TIME ZONE is slightly different, allowing only a single integer value for time zone specification:

SQL92 には、 SET variable はありません。( SET TRANSACTION ISOLATION LEVEL は除きます。) SQL92 における SET TIME ZONE の構文は少し異なっており、以下のように、タイムゾーンの指定には 1 つ の整数値のみが指定できます。

     SET TIME ZONE { interval_value_expression | LOCAL }