.\" This is -*-nroff-*- .\" XXX standard disclaimer belongs here.... .\" $Header: /usr/local/cvsroot/pgsql/src/man/create_type.l,v 1.4 1998/01/11 22:17:21 momjian Exp $ .\" Translated by Mitsuhiro Maeda (mitsu@cni.co.jp) .TH "CREATE TYPE" SQL 11/05/95 日本語PostgreSQL 日本語PostgreSQL .SH 名称 .\" create type - define a new base data type create type - 新しい基本データ型を定義します .SH 形式 .nf \fBcreate type\fP typename \fB(\fR\fBinternallength\fR = (number | \fBvariable\fR), [ \fBexternallength\fR = (number | \fBvariable\fR)\fB,\fR ] \fBinput\fR = input_function, \fBoutput\fR = output_function [\fB,\fR \fBelement\fR = typename] [\fB,\fR \fBdelimiter\fR = ] [\fB,\fR \fBdefault\fR = "string" ] [\fB,\fR \fBsend\fR = send_function ] [\fB,\fR \fBreceive\fR = receive_function ] [\fB,\fR \fBpassedbyvalue\fR]\fB)\fR .fi .\" \fBcreate type\fP typename as sql_commands .SH 説明 .\" .BR "Create type" .\" allows the user to register a new user data type with Postgres for use in .\" the current data base. .BR "create type" でユーザが Postgres に新しいデータ型を登録し、 現在のデータベースで使えるようにできます。 .\" The user who defines a type becomes its owner. 型を定義したユーザがその所有者になります。 .\" .IR Typename .\" is the name of the new type and must be unique within the types .\" defined for this database. .IR typename は新しい型の名前で、 このデータベースで定義されている型と重複してはいけません。 .PP .\" .BR "Create type" .\" requires the registration of two functions (using .\" .IR "create function" (l)) .\" before defining the type. .BR "create type" は型の定義の前に ( .IR "create function" (l) を使って) 登録されている 2つの関数を必要とします。 .\" The representation of a new base type is .\" determined by .\" .IR input_function , .\" which converts the type's external representation to an internal .\" representation usable by the operators and functions defined for the .\" type. 新しい基本型の表現は、 その型に定義されている演算子と関数から使うことのできる、 型の外部表現を内部表現に変換する .IR input_function で定義されます。 .\" Naturally, .\" .IR "output_function" .\" performs the reverse transformation. 当然、 .IR "output_function" はその逆のことを行います。 .\" Both the input and output .\" functions must be declared to take one or two arguments of type .\" \*(lqopaque\*(rq. 入力と出力の関数は両方とも \*(lqopaque\*(rq型の 1つあるいは 2つの引数を取るように 定義されていなくてはなりません。 .PP .\" New base data types can be fixed length, in which case .\" .BR "internallength" .\" is a positive integer, or variable length, in which case Postgres assumes .\" that the new type has the same format as the Postgres-supplied data type, .\" \*(lqtext\*(rq. 新しい基本データ型は固定長もしくは可変長の長さを取れ、 固定長の時には、 .BR "internallength" が正の整数に、また可変長の時には Postgres はその新しい型が Postgres の提供するデータ型 \*(lqtext\*(rq と 同じフォーマットであると仮定します。 .\" To indicate that a type is variable-length, set .\" .BR "internallength" .\" to .\" .IR "variable" . 型が可変長であると示すには、 .BR "internallength" を .IR "variable" にセットしてください。 .\" The external representation is similarly specified using the .\" .IR "externallength" .\" keyword. 外部表現は同様に .IR "externallength" キーワードを使って指定します。 .PP .\" To indicate that a type is an array and to indicate that a type has .\" array elements, indicate the type of the array element using the .\" .BR "element" .\" keyword. 型が配列であるいは配列の要素であると示すためには、 .BR "element" キーワードを使って配列の要素の型であることを示してください。 .\" For example, to define an array of 4 byte integers .\" (\*(lqint4\*(rq), specify 例えば 4バイト整数 (\*(lqint4\*(rq) の配列を定義するには、 .nf element = int4 .fi と指定してください。 .PP .\" To indicate the delimiter to be used on arrays of this type, .\" .BR "delimiter" .\" can be set to a specific character. この型の配列に使う区切り文字を示すのに、 .BR "delimiter" を特定の文字にセットすることができます。 .\" The default delimiter is the .\" comma (\*(lq,\*(rq) character. デフォルトの区切り文字はコンマ(\*(lq,\*(rq)文字です。 .PP .\" A .\" .BR "default" .\" value is optionally available in case a user wants some specific bit .\" pattern to mean \*(lqdata not present.\*(rq ユーザがある特別なビットパターンを \*(lqデータがない\*(rq ことを意味するようにしたいような場合には、 .BR "デフォルト" 値がオプションとして利用できます。 .PP .\" The optional functions .\" .IR "send_function" .\" and .\" .IR "receive_function" .\" are used when the application program requesting Postgres services .\" resides on a different machine. オプションの関数 .IR "send_function" と .IR "receive_function" は、 アプリケーションプログラムが違うマシンの Postgres にサービスを要求した時に使われます。 .\" In this case, the machine on which .\" Postgres runs may use a different format for the data type than used on .\" the remote machine. このケースでは、 Postgres が走るマシンは リモートのマシンとは違うデータ型のフォーマットを使っているかもしれません。 .\" In this case it is appropriate to convert data .\" items to a standard form when .\" .BR send ing .\" from the server to the client and converting from the standard format .\" to the machine specific format when the server .\" .BR receive s .\" the data from the client. この場合、 サーバからクライアントに .BR 送る(send) 時にデータ項目を標準的なフォーマットに変換し、 またサーバがクライアントからデータを .BR 受け取る(receive) 時に標準的なフォーマットからマシン特有のフォーマットに変換する のが適切です。 .\" If these functions are not specified, then .\" it is assumed that the internal format of the type is acceptable on .\" all relevant machine architectures. これらの関数が指定されなければ、 その型の内部フォーマットはすべての関連するマシンアーキテクチャで 受け入れ可能なものであると考えます。 .\" For example, single characters do .\" not have to be converted if passed from a Sun-4 to a DECstation, but .\" many other types do. 例えば、単一文字は Sun-4 から DECstation に送られたとしても 変換する必要はありませんが、多くの他の型についてはそうではありません。 .PP .\" The optional .\" .BR "passedbyvalue" .\" flag indicates that operators and functions which use this data type .\" should be passed an argument by value rather than by reference. オプションの .BR "passedbyvalue" フラッグはこのデータ型を使う演算子と関数は引数を参照渡しではなく 値渡しで引き渡すということを示します。 .\" Note .\" that only types whose internal representation is at most four bytes .\" may be passed by value. 型の内部表現が最大 4バイトであるものだけが値渡しで引き渡すことができます。 .PP .\" For new base types, a user can define operators, functions and .\" aggregates using the appropriate facilities described in this section. 新しい基本型に関して この節で説明された適切な方法でユーザは演算子と関数と集約関数を定義できます。 .\" .SH "ARRAY TYPES" .SH "配列型" .\" Two generalized built-in functions, .\" .BR array_in .\" and .\" .BR array_out, .\" exist for quick creation of variable-length array types. 2つの一般化された組み込み関数 .BR array_in と .BR array_out が可変長の配列型を素早く作るために存在しています。 .\" These .\" functions operate on arrays of any existing Postgres type. これらの関数は既存の Postgres の型ならどれでもその配列を操作できます。 .\" .SH "LARGE OBJECT TYPES" .SH "巨大オブジェクト型" .\" A \*(lqregular\*(rq Postgres type can only be 8192 bytes in length. \*(lq通常の\*(rq Postgres の型は 8192 バイトの長さしか取れません。 .\" If .\" you need a larger type you must create a Large Object type. もしもっと大きな型が必要なら、 巨大オブジェクト型を作らなくてはなりません。 .\" The .\" interface for these types is discussed at length in Section 7, the .\" large object interface. これらの型へのインタフェイスは 第 7 節の巨大オブジェクトインタフェイスで 充分に検討しました。 .\" The length of all large object types .\" is always .\" .IR variable, .\" meaning the .\" .BR internallength .\" for large objects is always -1. すべての巨大オブジェクト型は常に .IR variable です。つまり、巨大オブジェクトの .BR internallength は常に -1 ということです。 .SH 例 .nf -- .\" --This command creates the box data type and then uses the .\" --type in a class definition -- このコマンドは box データ型を作って、その型をクラスの定義に -- 使っています。 -- create type box (internallength = 8, input = my_procedure_1, output = my_procedure_2) create table MYBOXES (id = int4, description = box) .fi .nf -- .\" --This command creates a variable length array type with .\" --integer elements. -- このコマンドは整数の要素を持つ可変長の配列を作ります。 -- create type int4array (input = array_in, output = array_out, internallength = variable, element = int4) create table MYARRAYS (id = int4, numbers = int4array) .fi .nf -- .\" --This command creates a large object type and uses it in .\" --a class definition. -- このコマンドは巨大オブジェクト型を作って、その型をクラスの -- 定義に使っています。 -- create type bigobj (input = lo_filein, output = lo_fileout, internallength = variable) create table BIG_OBJS (id = int4, obj = bigobj) .fi .SH "制約" .\" Type names cannot begin with the underscore character (\*(lq_\*(rq) .\" and can only be 15 characters long. 型の名前は下線文字 (\*(lq_\*(rq)で始まってはいけません。 また、15文字を越えてはいけません。 .\" This is because Postgres silently .\" creates an array type for each base type with a name consisting of the .\" base type's name prepended with an underscore. これは Postgres が、 名前を基本型の名前の前に下線を付けて各基本型についての配列型を黙って 作っているからです。 .SH 参照 create function(l), create operator(l), drop type(l), large_objects(3).