.\" This is -*-nroff-*- .\" XXX standard disclaimer belongs here.... .\" $Header: /usr/local/cvsroot/pgsql/src/man/create_table.l,v 1.16 1998/04/07 18:12:54 momjian Exp $ .\" Translated by Mitsuhiro Maeda (mitsu@cni.co.jp) .TH "CREATE TABLE" SQL 09/25/97 日本語PostgreSQL .SH 名称 .\" create table - create a new class create table - 新しいクラスを作ります .SH 形式 .nf \fBcreate table\fR classname \fB(\fPattname type [\fBdefault\fP value] [\fBnot null\fP] [\fB,\fP attname type [\fBdefault\fP value] [\fBnot null\fP] [, ...] ]\fB )\fP [\fBinherits\fR \fB(\fR classname [\fB,\fR classname] \fB)\fR] [\fBconstraint\fR cname \fBcheck\fR \fB(\fR test \fB)\fR [, \fBcheck\fR \fB(\fR test \fB)\fR ] ] .fi .SH 説明 .\" .BR "Create Table" .\" will enter a new class into the current data base. .BR "create table" は現在のデータベースに新しいクラスを入れます。 .\" The class will be .\" \*(lqowned\*(rq by the user issuing the command. そのクラスはこのコマンドを発行したユーザ \*(lq所有\*(rq になります。 .\" The name of the .\" class is .\" .IR classname .\" and the attributes are as specified in the list of .\" .IR attname s. クラスの名前は .IR classname に、そして属性は .IR attname のリストで指定したものになります。 .\" Each attribute is created with the type specified by .\" .IR type "." 作成された各属性は .IR type で指定された型となります。 .\" Each type may be a simple type, a complex type (set) or an array type. 各型は単純な型または複合型(セット)または配列型を取ることができます。 .\" Each attribute may be specified to be non-null and .\" each may have a default value, specified by the .\" .IR default .\" clause which is the keyword "default" followed by a constant or expression. 各属性は非ヌルを指定することができます。 また、 キーワード "default" に定数または表現を続けた .IR default 句で指定したデフォルト値を指定することができます。 .PP .\" Each array attribute stores arrays that must have the same number of .\" dimensions but may have different sizes and array index bounds. 各配列属性には配列が保存されます。 同じ次元のでなくてはなりませんが、 サイズやインデックスの限界が違ってもかまいません。 .\" An .\" array of dimension .\" .IR n .\" is specified by appending .\" .IR n .\" pairs of square brackets: .IR n 次元の配列は .IR n ペアの鈎括弧を加えて指定します。 .nf att_name type[][]..[] .fi .\" N.B. As of Postgres version 6.0, consistant array dimensions within an .\" attribute are not enforced. This will likely change in a future release. 注意。 Postgres のバージョン 6.0 の時点で、 属性内で矛盾しない次元の配列は強制されていません。 これは将来のリリースで変更されるでしょう。 .PP .\" The optional .\" .BR inherits .\" clause specifies a collection of class names from which this class .\" automatically inherits all fields. オプションの .BR inherits 句はこのクラスが自動的にすべてのフィールドを継承するクラスの名前を指定します。 .\" If any inherited field name .\" appears more than once, Postgres reports an error. もし継承したフィールドの名前が一度以上出て来たら、 Postgres はエラーを報告します。 .\" Postgres automatically .\" allows the created class to inherit functions on classes above it in .\" the inheritance hierarchy. Postgres は自動的に 作成されたクラスが継承の階層の上のクラスの関数を継承することを許可します。 .\" Inheritance of functions is done according .\" to the conventions of the Common Lisp Object System (CLOS). 関数の継承は Common Lisp Object System (CLOS) の慣習にしたがって行われます。 .PP .\" Each new class .\" .IR classname .\" is automatically created as a type. 新しいクラス .IR classname は自動的に型として作られます。 .\" Therefore, one or more instances .\" from the class are automatically a type and can be used in .\" .IR "alter table" (l) .\" or other .\" .BR "create table" .\" statements. ですから、そのクラスからのひとつあるいはそれ以上のインスタンスは 自動的にひとつの型となりますので、 .IR "alter table" (l) や他の .BR "create table" 文などで使うことができます。 .\" See .\" .IR pgintro (1) .\" for a further discussion of this point. この点についてのさらなる検討は .IR pgintro (1) を参照してください。 .PP .\" The optional .\" .BR constraint .\" clause specifies a list of constraints or tests which new or updated entries .\" must satisfy for an insert or update operation to succeed. オプションの .BR constraint 句は新規あるいは更新されたエントリが挿入あるいは更新の作業を成功させるために 満たさなくてはならない制約あるいはテストのリストを指定します。 .\" Each constraint .\" must evaluate to a boolean expression. 各制約は boolean の表現に評価されます。 .\" Multiple attributes may be referenced within .\" a single constraint. 単一の制約から複数の属性を参照できます。 .PP .\" The new class is created as a heap with no initial data. 新規のクラスはヒープとして初期データなしで作られます。 .\" A class can .\" have no more than 1600 attributes (realistically, this is limited by the .\" fact that tuple sizes must be less than 8192 bytes), but this limit .\" may be configured lower at some sites. クラスは 1600 以上の属性を持つことができます (現実的には、これはタプルのサイズが 8192バイト以下でなくてはならない という事実に制約されます)が、 この制約をもっと小さく設定しているサイトもあります。 .\" A class cannot have the same .\" name as a system catalog class. クラスはシステムカタログのクラスと同じ名前を持つことができません。 .PP .SH 例 .nf -- .\" -- Create class emp with attributes name, sal and bdate -- 属性 name と sal と bdate を持つクラス emp を作ります -- create table emp (name char16, salary float4, bdate abstime) .fi .nf -- .\" --Create class permemp with pension information that .\" --inherits all fields of emp -- 年金情報を持ち emp のフィールドをすべて継承する -- クラス permemp を作ります -- create table permemp (plan char16) inherits (emp) .fi .nf -- .\" --Create class emppay with attributes name and wage with .\" --a default salary and constraints on wage range -- 属性 name と wage をデフォルトの給料と wage の範囲の制約を付けて -- クラス emppay を作ります -- create table emppay (name text not null, wage float4 default 10.00) constraint empcon check (wage > 5.30 and wage <= 30.00), check (name <> '') .fi .nf -- .\" --Create class tictactoe to store noughts-and-crosses .\" --boards as a 2-dimensional array -- 3目並べの盤を 2次元配列として保存するクラス tictactoe を -- 作ります -- create table tictactoe (game int4, board char[][]) .fi .nf -- .\" --Create a class newemp with a set attribute "manager". A .\" --set (complex) attribute may be of the same type as the .\" --relation being defined (as here) or of a different complex .\" --type. The type must exist in the "pg_type" catalog or be .\" --the one currently being defined. -- セット属性 "manager" を持つクラス newemp を作ります。セット(複合) -- 属性は定義されるリレーション(ここでは自身)と同じ型、または違う -- 複合型にもできます。型は "pg_type" カタログに存在するか、現在 -- 定義されようとしているものでなくてはなりません。 -- create table newemp (name text, manager newemp) .fi .SH 参照 drop table(l).