.\" This is -*-nroff-*- .\" XXX standard disclaimer belongs here.... .\" $Header: /usr/local/cvsroot/pgsql/src/man/pgbuiltin.3,v 1.10 1997/11/18 23:04:27 momjian Exp $ .\" .\" Japanese Version Copyright (c) 1998 Michihide Hotta .\" all rights reserved. .\" Translated Wed Jun 3 18:46:34 JST 1998 .\" by Michihide Hotta .\" .TH PGBUILTIN INTRO 04/01/97 PostgreSQL PostgreSQL .PP .\"0 .SH "DESCRIPTION" .\"0 This section describes the data types, functions and operators .\"0 available to users in Postgres as it is distributed. .SH 説明 この章では、配布された状態でユーザが使用できる Postgres の データ型、関数および演算子について説明している。 .PP .\"0 .SH "PGBUILTIN TYPES" .\"0 Built-in types are installed in every database. .\"0 .IR "psql" .\"0 has a \ed command to show these types. .SH "PG 組み込み型" 組み込み型はすべてのデータベースにインストールされる。 .IR "psql" では \ed でこれらの型を表示することができる。 .PP .\"0 Users may add new types to Postgres using the .\"0 .IR "define type" .\"0 command described in this manual. ユーザは、このマニュアルで説明されている .IR "define type" コマンドで新しい型を追加することもできる。 .PP .\"0 There are some data types defined by SQL/92 syntax .\"0 which are mapped directly .\"0 into native Postgres types. Note that the "exact numerics" .\"0 .IR decimal .\"0 and .\"0 .IR numeric .\"0 have fully implemented syntax but currently (postgres v6.2) .\"0 support only a limited .\"0 range of the values allowed by SQL/92. SQL/92 文法において定義されているデータ型の中には、直接 ネイティブの Postgres 型にマッピングされているものがある。 "正確な数値" である .IR decimal と .IR numeric は完全に実装されているが、現在 (postgres v6.2) は SQL/92 で 認められている限定された値の範囲しかサポートしていないことに 注意すること。 .PP .\"0 .SH "List of SQL/92 types" .SH "SQL/92 型の一覧" .PP .if n .ta 2 +15 +25 +40 .if t .ta 0.5i +1.5i +3.0i .in 0 .nf \fBPOSTGRES Type\fP \fBSQL/92 Type\fP \fBMeaning\fP char(n) character(n) fixed-length character string varchar(n) character varying(n) variable-length character string float4/8 float(p) floating-point number with precision p float8 double precision double-precision floating-point number float8 real double-precision floating-point number int2 smallint signed two-byte integer int4 int signed 4-byte integer int4 integer signed 4-byte integer int4 decimal(p,s) exact numeric for p <= 9, s = 0 int4 numeric(p,s) exact numeric for p == 9, s = 0 timestamp timestamp with time zone date/time timespan interval general-use time span .fi .in .PP .\"0 There are some constants and functions defined in SQL/92. SQL/92 で定義されている定数と関数がある。 .PP .\"0 .SH "List of SQL/92 constants" .SH "SQL/92 定数の一覧" .PP .if n .ta 2 +20 +40 .if t .ta 0.5i +1.5i +3.0i +4.0i .in 0 .nf \fBSQL/92 Function\fP \fBMeaning\fP current_date date of current transaction current_time time of current transaction current_timestamp date and time of current transaction .fi .in .PP .\"0 Many of the built-in types have obvious external formats. .\"0 However, several types are either unique to Postgres, .\"0 such as open and closed paths, or have several possibilities .\"0 for formats, such as date and time types. 組込み型の多くは明確な外部フォーマットを持つ。しかしながら、 開いた/閉じたパスのように Postgres 固有であったり、日付や 時刻型のようにいくつかのフォーマットを持ち得る型もある。 .PP .\"0 .SH "Syntax of date and time types" .SH 日付と時刻型の書式" .\"0 Most date and time types share code for data input. .\"0 For those types ( 日付と時刻型のほとんどは、データ入力においてコードを共有 している。これらの型( .IR datetime , .IR abstime , .IR timestamp , .IR timespan , .IR reltime , .IR date , .\"0 and .IR time ) .\"0 the input can have any of a wide variety of styles. For .\"0 numeric date representations, European and US conventions .\"0 can differ, and the proper interpretation is obtained .\"0 by using the .\"0 .IR set (l) .\"0 command before entering data. においては、いろいろなスタイルを持った入力パターンが 考えられる。数値型表現においてはヨーロッパと US の習慣 は異なっているので、データを入力する前に .IR set (l) コマンドを使って適切な解釈方法を与えてやることになる。 .\"0 Output formats can be set to one of three styles: .\"0 ISO-8601, SQL (traditional Oracle/Ingres), and traditional .\"0 Postgres (see section on .\"0 .IR "absolute time" ) .\"0 with the SQL style having European and US variants (see .\"0 .IR set (l)). 出力フォーマットは、ISO-8601, SQL (伝統的 Oracle/Ingres)、 および、ヨーロッパ型と US 型のバリエーション( .IR set (l) を参照)を持つ伝統的 Postgres( .IR "absolute time" の章を参照)のうちのいずれかのスタイルとなる。 .\"0 In future releases, the number of date/time types will .\"0 decrease, with the current implementation of datetime .\"0 becoming timestamp, timespan becoming interval, and .\"0 (possibly) abstime and reltime being deprecated in favor .\"0 of timestamp and interval. 将来のリリースでは日付/時刻型の数が減っていき、現在の実装に おける datetime は timestamp に、timespan は interval に変更 され、そしておそらく timestamp と interval が好んで使われる ので、abstime と reltime はなくなってゆくであろう。 .PP .\"0 .SH "DATETIME" .SH 日付と時刻 .\"0 General-use date and time is input using a wide range of .\"0 styles, including ISO-compatible, SQL-compatible, traditional .\"0 Postgres (see section on .\"0 .IR "absolute time") .\"0 and other permutations of date and time. Output styles can be .\"0 ISO-compatible, SQL-compatible, or traditional Postgres, .\"0 with the default set to be compatible with Postgres v6.0. 日付と時刻の一般的な使い方としては、ISO 互換、SQL 互換、伝統的 Postgres( .IR "absolute time" の章を参照)を含むさまざまなスタイルでの入力や、その他の日付 と時刻を表すものの代替としてである。出力スタイルは、ISO 互換、 SQL 互換、または Postgres v6.0 との互換性のためにセットされる、 デフォルトの伝統的 Postgres のいずれかである。 .PP .\"0 datetime is specified using the following syntax: datetime は以下の書式により指定される。 .PP .nf .\"0 Year-Month-Day [ Hour : Minute : Second ] [AD,BC] [ Timezone ] 年-月-日 [ 時 : 分 : 秒 ] [AD,BC] [ タイムゾーン ] .nf .\"0 YearMonthDay [ Hour : Minute : Second ] [AD,BC] [ Timezone ] 年月日 [ 時 : 分 : 秒 ] [AD,BC] [ タイムゾーン ] .nf .\"0 Month Day [ Hour : Minute : Second ] Year [AD,BC] [ Timezone ] 月 日 [ 時 : 分 : 秒 ] 年 [AD,BC] [ タイムゾーン ] .sp .\"0 where .\"0 Year is 4013 BC, ..., very large .\"0 Month is Jan, Feb, ..., Dec or 1, 2, ..., 12 .\"0 Day is 1, 2, ..., 31 .\"0 Hour is 00, 02, ..., 23 .\"0 Minute is 00, 01, ..., 59 .\"0 Second is 00, 01, ..., 59 (60 for leap second) .\"0 Timezone is 3 characters or ISO offset to GMT ここで、 年は 4013 BC 〜 巨大な数 月は Jan, Feb 〜 Dec または 1, 2 〜 12 日は 1, 2 〜 31 時は 00, 01 〜 23 分は 00, 01 〜 59 秒は 00, 01 〜 59 (60 はうるう秒) タイムゾーンは 3 文字または GMT に対する ISO オフセット である。 .fi .PP .\"0 Valid dates are from Nov 13 00:00:00 4013 BC GMT to far into .\"0 the future. Timezones are either three characters (e.g. "GMT" .\"0 or "PST") or ISO-compatible offsets to GMT (e.g. "-08" or .\"0 "-08:00" when in Pacific Standard Time). .\"0 Dates are stored internally in Greenwich Mean Time. .\"0 Input and output routines .\"0 translate time to the local time zone of the server. 有効な日付は Nov 13 00:00:00 4013 BC GMT から遠い未来まで である。タイムゾーンは 3 文字(たとえば "GMT" や "PST")または GMT に対する ISO 互換オフセット(たとえば太平洋標準時において は "-08" や "-08:00")である。日付は内部的にはグリニッジ標準時 で格納される。入出力ルーチンでは、時刻をサーバのローカル・ タイムゾーンに変換する。 .PP .\"0 The special values `current', .\"0 `infinity' and `-infinity' are provided. .\"0 `infinity' specifies a time later than any valid time, and .\"0 `-infinity' specifies a time earlier than any valid time. .\"0 `current' indicates that the current time should be .\"0 substituted whenever this value appears in a computation. 特別な値 `current'、`infinity' および `-infinity' が提供 されている。`infinity' はすべての有効な時間より後を示し、 `-infinity' はすべての有効な時間より前を示す。`current' は、計算時にこの値が現れる時は常に現在時刻に置き換えられる ことを示す。 .PP .\"0 The strings .\"0 `now', .\"0 `today', .\"0 `yesterday', .\"0 `tomorrow', .\"0 and `epoch' can be used to specify .\"0 time values. `now' means the current time, and differs from .\"0 `current' in that the current time is immediately substituted .\"0 for it. `epoch' means Jan 1 00:00:00 1970 GMT. `now', `today', `yesterday', `tomorrow' および `epoch' という文字列は、時間の値を表すのに使用できる。`now' は現在時刻を意味しており、即時に現在時刻に置き換えられる `current' とは異なる。`epoch' は Jan 1 00:00:00 1970 GMT を表す。 .PP .\"0 .SH "TIMESPAN" .SH 期間 .\"0 General-use time span is input using a wide range of .\"0 syntaxes, including ISO-compatible, SQL-compatible, .\"0 traditional Postgres (see section on .\"0 .IR "relative time" .\"0 ) and other permutations of time span. Output formats .\"0 can be ISO-compatible, SQL-compatible, or traditional .\"0 Postgres, with the default set to be Postgres-compatible. .\"0 Months and years are a "qualitative" time interval, .\"0 and are stored separately from the other "quantitative" .\"0 time intervals such as day or hour. For date arithmetic, .\"0 the qualitative time units are instantiated in the context .\"0 of the relevant date or time. 期間の一般的な使い方としては、ISO 互換、SQL 互換、伝統的 Postgres( .IR "absolute time" の章を参照)を含むさまざまな書式での入力や、その他の期間を 表すものの代替としてである。出力フォーマットは、ISO 互換、 SQL 互換、またはPostgres との互換性のためにセットされる、 デフォルトの伝統的 Postgres のいずれかである。 月と年は "定性" 時間間隔であり、日や時間などその他の "定性" 時間間隔とは区別して格納される。日数計算をする場合 には、定性時間単位は関連する日付や時間の内容において具体化 される。 .PP .\"0 Time span is specified with the following syntax: 期間は以下の書式により指定される。 .PP .nf .\"0 Quantity Unit [Quantity Unit...] [Direction] 量 単位 [時間単位...][方向] .nf .\"0 @ Quantity Unit [Direction] @ 量 単位 [方向] .sp .\"0 where .\"0 Quantity is ..., `-1', `0', `1', `2', ... .\"0 Unit is `second', `minute', `hour', `day', `week', `month', `year', .\"0 or abbreviations or plurals of these units. .\"0 Direction is `ago'. ここで、 量は ..., `-1', `0', `1', `2', ... 単位は `second', `minute', `hour', `day', `week', `month', `year' またはこれらの単位の省略形や複数形、方向は `ago' です。 .fi .PP .\"0 .SH "ABSOLUTE TIME" .SH 絶対時間 .\"0 Absolute time (abstime) is a limited-range (+/- 68 years) .\"0 and limited-precision (1 sec) date data type. .\"0 .IR "datetime" .\"0 may be preferred, since it .\"0 covers a larger range with greater precision. 絶対時間 (abstime) は限られた範囲(前後 68 年間)と限られた精度 (1 秒)の日付データ型である。 .IR "datetime" の方が、より大きな範囲と精度をカバーするので良く使われる。 .PP .\"0 Absolute time is specified using the following syntax: 絶対時刻は以下の書式により指定されます。 .PP .nf .\"0 Month Day [ Hour : Minute : Second ] Year [ Timezone ] 月 日 [ 時 : 分 : 秒 ] 年 [ タイムゾーン ] .sp .\"0 where .\"0 Month is Jan, Feb, ..., Dec .\"0 Day is 1, 2, ..., 31 .\"0 Hour is 01, 02, ..., 24 .\"0 Minute is 00, 01, ..., 59 .\"0 Second is 00, 01, ..., 59 .\"0 Year is 1901, 1902, ..., 2038 ここで、 月は Jan, Feb, ..., Dec or 1, 2, ..., 12 日は 1, 2, ..., 31 時は 00, 02, ..., 23 分は 00, 01, ..., 59 秒は 00, 01, ..., 59 (60 はうるう秒) 年は 1901, 1902, ..., 2038 .fi .PP .\"0 Valid dates are from Dec 13 20:45:53 1901 GMT to Jan 19 .\"0 03:14:04 2038 GMT. As of Version 3.0, times are no longer .\"0 read and written using Greenwich Mean Time; the input and .\"0 output routines default to the local time zone. 有効な日付は Dec 13 20:45:53 1901 GMT から Jan 19 03:14:04 2038 GMT までです。Version 3.0 では、もはや時刻はグリニッジ標準時では読み書き されません。入出力ルーチンのデフォルトはローカルのタイムゾーンを参照 するようになっています。 .PP .\"0 All special values allowed for .IR "datetime" .\"0 are also allowed for に対するすべての特殊な値は、そのまま .\"0 .IR "absolute time". .IR 絶対時刻 に対しても使用できます。 .PP .\"0 .SH "RELATIVE TIME" .SH 相対時刻 .\"0 Relative time (reltime) is a limited-range (+/- 68 years) .\"0 and limited-precision (1 sec) time span data type. .\"0 .IR "timespan" .\"0 may be preferred, since it .\"0 covers a larger range with greater precision, allows multiple .\"0 units for an entry, and correctly handles qualitative time .\"0 units such as year and month. For reltime, only one quantity .\"0 and unit is allowed per entry, which can be inconvenient for .\"0 complicated time spans. 相対時刻 (reltime) は、限られた範囲(前後 68 年間)と限られた 精度(1 秒)をもつ期間指定データ型です。 .IR "timespan" の方がより大きな範囲と精度を持ち、1 つのエントリで複数の単位を 使用することができ、また年や月といった定量的な時間を正確に 処理できるため好まれます。一方 reltime は、1 つのエントリに つき 1 つの量と 1 つの単位しか使えないので複雑な期間を扱うには 不便です。 .PP .\"0 Relative time is specified with the following syntax: 相対時刻は以下の書式で指定されます。 .PP .nf .\"0 @ Quantity Unit [Direction] @ 量 単位 [方向] .sp .\"0 where .\"0 Quantity is `1', `2', ... .\"0 Unit is ``second'', ``minute'', ``hour'', ``day'', ``week'', .\"0 ``month'' (30-days), or ``year'' (365-days), .\"0 or PLURAL of these units. .\"0 Direction is ``ago'' ここで、 量は ..., `-1', `0', `1', `2', ... 単位は `second', `minute', `hour', `day', `week', `month', `year' またはこれらの単位の省略形や複数形、方向は `ago' です。 .fi .PP .\"0 .RB ( Note : .\"0 Valid relative times are less than or equal to 68 years.) .\"0 In addition, the special relative time \*(lqUndefined .\"0 RelTime\*(rq is provided. .RB (注意: 有効な相対時刻は 68 年以下です)また、特殊な相対時刻である \*(lq未定義の RelTime\*(rq が提供されています。 .PP .\"0 .SH "TIMESTAMP" .SH タイムスタンプ .\"0 This is currently a limited-range absolute time which closely .\"0 resembles the .\"0 .IR abstime .\"0 data type. It shares the general input parser with the other .\"0 date/time types. In future releases this type will absorb .\"0 the capabilities of the datetime type and will move toward .\"0 SQL92 compliance. これは現在では、 .IR abstime データ型に非常に良く似た、限られた範囲を持つ絶対時刻です。 これは、汎用入力パーザを他の日付/時刻型と共有しています。 将来のリリースでは、この型は datetime 型の機能を吸収し、 今後の SQL92 準拠に移されます。 .PP .\"0 timestamp is specified using the same syntax as for datetime. timestamp は datetime と同じ書式を使って表されます。 .PP .\"0 .SH "TIME RANGES" .SH 時間の範囲 .\"0 Time ranges are specified as: 時間の範囲は以下の書式で表されます。 .PP .nf [ 'abstime' 'abstime'] .fi .\"0 where .\"0 .IR abstime .\"0 is a time in the absolute time format. Special abstime .\"0 values such as \*(lqcurrent\*(rq, \*(lqinfinity\*(rq and .\"0 \*(lq-infinity\*(rq can be used. ここで、 .IR abstime は絶対時刻フォーマットの時刻です。特別な abstime 値である \*(lqcurrent\*(rq, \*(lqinfinity\*(rq および \*(lq-infinity\*(rq も使えます。 .PP .\"0 .SH "Syntax of geometric types" .SH 座標型の書式 .\"0 .SH "POINT" .SH 座標点 .\"0 Points are specified using the following syntax: 座標点は以下の書式で指定されます。 .PP .nf ( x , y ) .nf x , y .sp .\"0 where .\"0 x is the x-axis coordinate as a floating point number .\"0 y is the y-axis coordinate as a floating point number ここで x は X 座標値(浮動小数点) y は Y 座標値(浮動小数点) .fi .PP .\"0 .SH "LSEG" .SH 線分 .\"0 Line segments are represented by pairs of points. .PP lseg is specified using the following syntax: 線分 (lseg) は以下の書式で指定されます。 .PP .nf ( ( x1 , y1 ) , ( x2 , y2 ) ) .nf ( x1 , y1 ) , ( x2 , y2 ) .nf x1 , y1 , x2 , y2 .sp .\"0 where .\"0 (x1,y1) and (x2,y2) are the endpoints of the segment ここで (x1,y1) および (x2,y2) は線分の終端 .fi .PP .\"0 .SH "BOX" .SH 長方形 .\"0 Boxes are represented by pairs of points which are opposite .\"0 corners of the box. 長方形(boxes)は、その対角となる座標点の組で表されます。 .PP .\"0 box is specified using the following syntax: 長方形は以下の書式で指定されます。 .PP .nf ( ( x1 , y1 ) , ( x2 , y2 ) ) .nf ( x1 , y1 ) , ( x2 , y2 ) .nf x1 , y1 , x2 , y2 .sp .\"0 where .\"0 (x1,y1) and (x2,y2) are opposite corners ここで (x1,y1) および (x2,y2) は対角線上の角 .fi .PP .\"0 Boxes are output using the first syntax. The corners are .\"0 reordered on input to store the lower left corner first .\"0 and the upper right corner last. Other corners of the box .\"0 can be entered, but the lower left and upper right corners .\"0 are determined from the input and stored. 長方形は,最初の書式を使って出力されます。2 つの角は、左下の 角を最初に,右上の角を最後に格納するように並べ替えられます. 長方形の中の他の角を入力することもできますが,左下と右上の角 が入力により決定され,格納されます. .PP .\"0 .SH "PATH" .SH パス .\"0 Paths are represented by sets of points. Paths can be "open", .\"0 where the first and last points in the set are not connected, .\"0 and "closed", where the first and last point are connected. .\"0 Functions .\"0 .IR popen(p) .\"0 and .\"0 .IR pclose(p) .\"0 are supplied to force a path to be open or closed, and functions .\"0 .IR isopen(p) .\"0 and .\"0 .IR isclosed(p) .\"0 are supplied to select either type in a query. パス(path)は座標点のセットにより表現されます.パスは,座標点 セットの中の最初の点と最後の点が接続されていない「開いた」 状態か,接続されている「閉じた」状態かのいずれかです. あるパスを強制的に開いた/閉じた状態にする .OR popen(p) と .IR pclose(p) が提供されており,また .IR isopen(p) と .IR isclosed(p) を使って、問い合わせの中でいずれかのタイプを選択することが できます. .PP .\"0 path is specified using the following syntax: パスは以下のような書式で指定します. .PP .nf ( ( x1 , y1 ) , ... , ( xn , yn ) ) .nf [ ( x1 , y1 ) , ... , ( xn , yn ) ] .nf ( x1 , y1 ) , ... , ( xn , yn ) .nf ( x1 , y1 , ... , xn , yn ) .nf x1 , y1 , ... , xn , yn .sp .\"0 where .\"0 (x1,y1),...,(xn,yn) are points 1 through n .\"0 a leading "[" indicates an open path .\"0 a leading "(" indicates a closed path ここで, (x1,y1),...,(xn,yn) は 1 から n までの座標点 "[" で始まるのは開いたパス "(" で始まるのは閉じたパス を表します。 .fi .PP .\"0 Paths are output using the first syntax. .\"0 Note that Postgres versions prior to .\"0 v6.1 used a format for paths which had a single leading .\"0 parenthesis, a "closed" flag, an integer count of the number .\"0 of points, then the list of points followed by a closing .\"0 parenthesis. The built-in function upgradepath() is supplied .\"0 to convert paths dumped and reloaded from pre-v6.1 databases. パスは最初の書式を使って出力されます.Postgres の v6.1 より 前のバージョンまでは,パスの書式として,"(" で始まる「閉じた」 フラグ,座標点の数を表す 1 つの整数カウンタ,座標点のリスト, 最後に閉じ括弧 ")" という形式を使用していました. v6.1 以前のデータベースからダンプおよびリロードされたパスを 変換するために,組み込み関数 upgradepath() が提供されています。 .PP .\"0 .SH "POLYGON" .SH 多角形 .\"0 Polygons are represented by sets of points. Polygons should .\"0 probably be considered equivalent to closed paths, but are .\"0 stored differently and have their own set of support routines. 多角形(poligon)は座標点のセットで表現されます.多角形は閉じた パスと同じであると考えられますが,異なった方法で格納され,また 双方固有のサポートルーチンのセットを持っています. .PP .\"0 polygon is specified using the following syntax: 多角形は以下の書式で指定されます. .PP .nf ( ( x1 , y1 ) , ... , ( xn , yn ) ) .nf ( x1 , y1 ) , ... , ( xn , yn ) .nf ( x1 , y1 , ... , xn , yn ) .nf x1 , y1 , ... , xn , yn .sp .\"0 where .\"0 (x1,y1),...,(xn,yn) are points 1 through n ここで, (x1,y1),...,(xn,yn) は 1 から n までの座標点 .fi .PP .\"0 Polygons are output using the first syntax. .\"0 The last format is supplied to be backward compatible with .\"0 v6.0 and earlier path formats and will not be supported in .\"0 future versions of Postgres. a single leading "(" indicates .\"0 a v6.0-compatible format .\"0 ( x1 , ... , xn , y1 , ... , yn ) .\"0 Note that Postgres versions prior to v6.1 used a format .\"0 for polygons which had a single leading parenthesis, the .\"0 list of x-axis coordinates, the list of y-axis coordinates, .\"0 followed by a closing parenthesis. .\"0 The built-in function upgradepoly() is supplied to convert .\"0 polygons dumped and reloaded from pre-v6.1 databases. 多角形は最初の書式により出力されます.最後のフォーマットはv6.0 以前のパスのフォーマットとして過去への互換性のために残されて いますが、将来の postgres のバージョンではサポートされなく なるでしょう。先行する単独の "(" は v6.0 互換フォーマット ( x1 , ... , xn , y1 , ... , yn )であることを表します。 Postgres の v6.1 より前のバージョンまでは,多角形の書式として, "(" ,X 座標のリスト,Y 座標のリスト,最後に閉じ括弧 ")" という形式を使用していました.v6.1 以前のデータベースから ダンプまたはリロードされた多角形を変換するために,組み込み関数 upgradepoly() が提供されています. .PP .\"0 .SH "CIRCLE" .SH 円 .\"0 Circles are represented by a center point and a radius. 円(circle)は中心点と半径により表現されます. .PP .\"0 circle is specified using the following syntax: 円は以下の書式により指定されます. .PP .nf < ( x , y ) , r > .nf ( ( x , y ) , r ) .nf ( x , y ) , r .nf x , y , r .sp .\"0 where .\"0 (x,y) is the center of the circle .\"0 r is the radius of the circle ここで, (x,y) は円の中心点 r は円の半径 を表します。 .fi .PP .\"0 Circles are output using the first syntax. 円は最初の書式で出力されます. .PP .\"0 .SH "Built-in operators and functions" .SH 組み込み演算子と関数 .\"0 .SH OPERATORS .SH 演算子 .\"0 Postgres provides a large number of built-in operators on .\"0 system types. These operators are declared in the system .\"0 catalog \*(lqpg_operator\*(rq. Every entry in .\"0 \*(lqpg_operator\*(rq includes the object ID of the procedure .\"0 that implements the operator. Postgresでは,システム型に対して多くの種類の組み込み演算子が 提供されています.これらの演算子は,システムカタログ \*(lqpg_operator\*(rq の中で宣言されています. \*(lqpg_operator\*(rq の中の各エントリは,演算子を実装する 手続きのオブジェクト ID により構成されています. .PP .\"0 Users may invoke operators using the operator name, as in: ユーザは、演算子の名前を使って以下のよう演算子を呼び出します。 .PP .in 1i .nf .\"0 select * from emp where salary < 40000; select * from 従業員 where 給与 < 40000; .fi .in .PP .\"0 Alternatively, users may call the functions that implement .\"0 the operators directly. In this case, the query above would .\"0 be expressed as: また、ユーザは演算子直接実装した関数を呼ぶこともできます。 この場合は、上の問い合わせは以下のように表現されます。 .PP .in 1i .nf .\"0 select * from emp where int4lt(salary, 40000); select * from 従業員 where int4lt(給与, 40000); .fi .in .PP .\"0 .IR "psql" .\"0 has a \ed command to show these operators. .IR "psql" ではこれらの演算子を表示する \ed コマンドが提供されています。 .PP .\"0 .SH "FUNCTIONS" .SH 関数 .\"0 Many data types have functions available for conversion to .\"0 other related types. In addition, there are some type-specific .\"0 functions. Functions which are also available through .\"0 operators are documented as operators only. 多くのデータ型においては、関連する他の型への変換をするための 関数が用意されています。さらに、その型特有の関数を持つものも あります。演算子を通しても使用できるような関数は、演算子として のみ文書化されています。 .PP .\"0 Some functions defined for text are also available .\"0 for char() and varchar(). text型として定義されている関数の中には、char() や varchar() においても使用できるものがあります。 .PP .\"0 For the date_part() and date_trunc() functions, arguments .\"0 can be `year', `month', `day', `hour', `minute', and `second', .\"0 as well as the more specialized quantities `decade', `century', .\"0 `millenium', `millisecond', and `microsecond'. .\"0 date_part() allows `dow' to return day of week and `epoch' .\"0 to return seconds since 1970 for datetime .\"0 and 'epoch' to return total elapsed seconds for timespan. date_part() 関数および date_trunc() 関数においては、引数として、 `year'、`month'、`day'、`hour'、`minute'、`second' に加え、 より限定した量を表す `decade'、`century'、`millenium'、 `millisecond'、`microsecond' も使えます。date_part() 関数では、 曜日を返すための `dow' や、datetime のために 1970 年からの 通算秒を返す `epoch' や、timespanのために通算秒の合計を返す 'epoch' も使えます。 .nf .\"0 Functions: 関数: .\"0 integer 整数 .\"0 float8 float(int) convert integer to floating point .\"0 float4 float4(int) convert integer to floating point float8 float(int) 整数を浮動小数点に変換 float4 float4(int) 整数を浮動小数点に変換 .\"0 float 浮動小数点 .\"0 int integer(float) convert floating point to integer int integer(float) 浮動小数点を整数に変換 .\"0 text テキスト .\"0 text lower(text) convert text to lower case .\"0 text lpad(text,int,text) left pad string to specified length .\"0 text ltrim(text,text) left trim characters from text .\"0 text position(text,text) extract specified substring .\"0 text rpad(text,int,text) right pad string to specified length .\"0 text rtrim(text,text) right trim characters from text .\"0 text substr(text,int[,int]) extract specified substring .\"0 text upper(text) convert text to upper case text lower(text) テキストを小文字に変換 text lpad(text,int,text) 指定された長さまで文字列を左から詰める ltrim(text,text) テキストの左から文字を切り取る text position(text,text) 指定された文字列の抽出 rpad(text,int,text) 指定された長さまで文字列を左から詰める rtrim(text,text) テキストの右から文字を切り取る text substr(text,int[,int]) 指定された文字列の抽出 text upper(text) テキストを大文字に変換 .\"0 abstime 絶対時間 .\"0 bool isfinite(abstime) TRUE if this is a finite time .\"0 datetime datetime(abstime) convert to datetime bool isfinite(abstime) 有限の時間であれば真 datetime datetime(abstime) datetime へ変換 .\"0 date 日付 .\"0 datetime datetime(date) convert to datetime .\"0 datetime datetime(date,time) convert to datetime datetime datetime(date) datetime へ変換 datetime datetime(date,time) datetime へ変換 .\"0 datetime 日付と時刻 .\"0 timespan age(datetime,datetime) date difference .\"0 preserving months and years .\"0 float8 date_part(text,datetime) specified portion of date field .\"0 datetime date_trunc(text,datetime) truncate date at specified units .\"0 bool isfinite(datetime) TRUE if this is a finite time .\"0 abstime abstime(datetime) convert to abstime timespan age(datetime,datetime) 月と年を保持して date 差分を取る float8 date_part(text,datetime) 日付フィールドの指定された部分 datetime date_trunc(text,datetime) 指定された単位での日付の切り捨て bool isfinite(datetime) 有限の時間であれば真 abstime abstime(datetime) abstime へ変換 .\"0 reltime 相対時刻 .\"0 timespan timespan(reltime) convert to timespan timespan timespan(reltime) timespan へ変換 .\"0 time 時間 .\"0 datetime datetime(date,time) convert to datetime datetime datetime(date,time) datetime へ変換 .\"0 timespan 期間 .\"0 float8 date_part(text,timespan) specified portion of time field .\"0 bool isfinite(timespan) TRUE if this is a finite time .\"0 reltime reltime(timespan) convert to reltime float8 date_part(text,timespan) 時刻フィールドの指定された部分 bool isfinite(timespan) 有限の時間であれば真 .\"0 box 長方形 .\"0 box box(point,point) convert points to box .\"0 float8 area(box) area of box box box(point,point) 座標点を長方形に変換 float8 area(box) 長方形の面積 .\"0 path パス .\"0 bool isopen(path) TRUE if this is an open path .\"0 bool isclosed(path) TRUE if this is a closed path bool isopen(path) 開いたパスであれば真 bool isclosed(path) 閉じたパスであれば真 .\"0 circle 円 .\"0 circle circle(point,float8) convert to circle .\"0 polygon polygon(npts,circle) convert to polygon with npts points .\"0 float8 center(circle) radius of circle .\"0 float8 radius(circle) radius of circle .\"0 float8 diameter(circle) diameter of circle .\"0 float8 area(circle) area of circle circle circle(point,float8) 円に変換 polygon polygon(npts,circle) npts 個の頂点を持つ正多角形に変換 float8 center(circle) 円の中心点 float8 radius(circle) 円の半径 float8 diameter(circle) 円の直径 float8 area(circle) 円の面積 .fi .PP .\"0 SQL/92 defines functions with specific syntax. Some of these .\"0 are implemented using other Postgres functions. SQL/92 では関数を特定の書式で定義している。これらのうちの いくつかでは、その他の Postgres 関数を使って実装されている。 .nf .\"0 SQL/92 Functions: SQL/92 関数 .\"0 text テキスト .\"0 text position(text in text) extract specified substring .\"0 text substring(text [from int] [for int]) .\"0 extract specified substring .\"0 text trim([leading|trailing|both] [text] from text) .\"0 trim characters from text text position(text in text) 指定された文字列を抽出 text substring(text [from int] [for int]) 指定された文字列を抽出 text trim([leading|trailing|both] [text] from text) テキストから文字列を取り除く .fi .PP .\"0 .SH "ADDITIONAL INFORMATION" .SH 追加情報 .\"0 .IR "psql" .\"0 has a variety of \ed commands for showing system information. .\"0 Consult those .\"0 .IR "psql" .\"0 commands for more listings. .IR "psql" では、システム情報を表示するためのさまざまな \ed コマンドが 提供されています。詳細な一覧表は、これらの .IR "psql" コマンドを使用してください。 .PP .\"0 .SH "SEE ALSO" .SH 関連事項 .IR set (l), .IR show (l), .IR reset (l), .IR psql (1). .\"0 For examples on specifying literals of built-in types, see .\"0 .IR SQL (l). 組込み型に対する定数を指定するための例は .IR SQL (l) を参照してください。 .PP .SH BUGS .\"0 Although most of the input and output functions corresponding .\"0 to the base types (e.g., integers and floating point numbers) .\"0 do some error-checking, some are not particularly rigorous .\"0 about it. More importantly, few of the operators and .\"0 functions (e.g., addition and multiplication) perform any .\"0 error-checking at all. Consequently, many of the numeric .\"0 operators can (for example) silently underflow or overflow. (整数や浮動小数点といった)ベース型に対応するほとんどの入出力 関数はエラーチェックを行いますが、特別厳格なチェックを行わない ものもあります。特に、(加算や乗算のように)まったくエラーチェック を行わない演算子や関数もあります。したがって、多くの(たとえば) 数値演算子はアンダーフローやオーバーフローが起こったことに 気が付きません。 .PP .\"0 Some of the input and output functions are not invertible. .\"0 That is, the result of an output function may lose precision .\"0 when compared to the original input. 入出力関数のうちのいくつかは可換ではありません。すなわち、ある 出力の結果をその計算前の入力と比べた時、精度が失われる場合も あります。 .SH 翻訳者 堀田 倫英