.\" This is -*-nroff-*- .\" XXX standard disclaimer belongs here.... .\" $Header: /usr/local/cvsroot/pgsql/src/man/alter_table.l,v 1.5 1998/03/31 04:44:19 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 "ALTER TABLE" SQL 09/25/97 PostgreSQL .\"0 .SH NAME .\"0 alter table - add attributes to a class, .\"0 or rename an attribute or class .SH 名前 alter table - クラスに属性を追加したり、 属性またはクラスの名前を変える .\"0 .SH SYNOPSIS .\"0 .nf .\"0 \fBalter table\fR classname [ * ] .\"0 \fBadd\fR [ \fBcolumn\fR ] attname type .\"0 \fBalter table\fR classname [ * ] .\"0 \fBadd\fR \fB(\fR attname type \fB)\fR .\"0 .\"0 \fBalter table\fR classname1 .\"0 \fBrename to\fR classname2 .\"0 .\"0 \fBalter table\fR classname1 [\fB*\fR] .\"0 \fBrename [column]\fR attname1 \fBto\fR attname2 .\"0 .fi .SH 書式 .nf \fBalter table\fR クラス名 [ * ] \fBadd\fR [ \fBcolumn\fR ] 属性名 型 \fBalter table\fR クラス名 [ * ] \fBadd\fR \fB(\fR 属性名 型 \fB)\fR \fBalter table\fR クラス名1 \fBrename to\fR クラス名2 \fBalter table\fR クラス名1 [\fB*\fR] \fBrename\fR [ \fBcolumn\fR ] 属性名1 \fBto\fR 属性名2 .fi .\"0 .SH DESCRIPTION .\"0 The .\"0 .BR "alter table" .\"0 command causes a new attribute to be added to an existing class, .\"0 .IR classname , .\"0 or the name of a class or attribute to change .\"0 without changing any of the data contained in the affected class. .\"0 Thus, the class or attribute will remain of the same type and size .\"0 after this command is executed. .SH 説明 .BR "alter table" コマンドは、存在するクラス .IR クラス名 への新しい属性の追加や、クラスや属性の名前の変更を、 影響を受けるクラスに含まれるデータをいっさい変更することなく 行うことができる。そのため、このコマンドが実行された後も、 元々あったクラスや属性については同じ型やサイズで残される。 .PP .\"0 The new attributes and their types are specified .\"0 in the same style and with the the same restrictions as in .\"0 .IR "create table" (l). 新しい属性とそれらの型は同じスタイルで指定され、 .IR "create table" (l) で定義したものと同じ制限が適用される。 .PP .\"0 In order to add an attribute to each class in an entire inheritance .\"0 hierarchy, use the .\"0 .IR classname .\"0 of the superclass and append a \*(lq*\*(rq. (By default, the .\"0 attribute will not be added to any of the subclasses.) This should .\"0 .BR always .\"0 be done when adding an attribute to a superclass. If it is not, .\"0 queries on the inheritance hierarchy such as 継承を伴う階層構造全体の各クラスに対してある属性を追加するには、 スーパークラスの .IR クラス名 を使い、\*(lq*\*(rq を追加する(デフォルトでは、いかなるサブクラス にも追加されない)。これは、スーパークラスへ属性を追加する際には .BR 常に 行わなければならない。これを怠ると、 .nf select * from super* s .fi のような継承を伴う階層構造への問い合わせは .\"0 will not work because the subclasses will be missing an attribute .\"0 found in the superclass. 動作しない。これは、スーパークラスで見つかった属性がサブクラス にはないためである。 .PP .\"0 For efficiency reasons, default values for added attributes are not .\"0 placed in existing instances of a class. That is, existing instances .\"0 will have NULL values in the new attributes. If non-NULL values are .\"0 desired, a subsequent .\"0 .IR update (l) .\"0 query should be run. 効率に関する理由により、追加された属性に対するデフォルト値は、 クラスの存在するインスタンスにおいて置き換えは行われない。 すなわち、存在するインスタンスでは、新しい属性は必ず NULL の値を持つ。もし NULL でない値を入れたい場合は、続いて .IR update (l) (query)を実行すれば良い。 .PP .\"0 (ここは上と重複しているですな?) .\"0 In order to rename an attribute in each class in an entire inheritance .\"0 hierarchy, use the .\"0 .IR classname .\"0 of the superclass and append a \*(lq*\*(rq. (By default, the attribute.\"0 .\"0 will not be renamed in any of the subclasses.) This should .\"0 .BR always .\"0 be done when changing an attribute name in a superclass. If it is .\"0 not, queries on the inheritance hierarchy such as .\"0 .nf .\"0 select * from super* s .\"0 .fi .\"0 will not work because the subclasses will be (in effect) missing an .\"0 attribute found in the superclass. .PP .\"0 You must own the class being modified in order to rename it or part of .\"0 its schema. Renaming any part of the schema of a system catalog is .\"0 not permitted. クラスやそのスキーマの名前を変えるには、あなたはその変更する クラスの所有者でなければならない。システムカタログに属するスキーマ のいかなる部分も、変更することは禁止されている。 .PP .\"0 You must own the class in order to change its schema. クラスのスキーマを変更するためには、あなたはその変更する クラスの所有者でなければならない。 .\"0 .SH EXAMPLE .\"0 .nf .\"0 -- .\"0 -- add the date of hire to the emp class .\"0 -- .\"0 alter table emp add column hiredate abstime .\"0 -- .\"0 -- add a health-care number to all persons .\"0 -- (including employees, students, ...) .\"0 -- .\"0 alter table person * add column health_care_id int4 .\"0 -- .\"0 -- change the emp class to personnel .\"0 -- .\"0 alter table emp rename to personnel .\"0 -- .\"0 -- change the sports attribute to hobbies .\"0 -- .\"0 alter table emp rename column sports to hobbies .\"0 -- .\"0 -- make a change to an inherited attribute .\"0 -- .\"0 alter table person * rename column last_name to family_name .\"0 .fi .SH 例 .nf -- -- 従業員クラスに雇用開始日を追加する -- alter table 従業員 add column 雇用開始日 abstime -- -- すべての人物(従業員、学生などを含む)に、 -- 健康管理番号を追加する -- alter table 人物 * add column 健康管理番号 int4 -- -- 従業員クラスを個人に変更する -- alter table 従業員 rename to 個人 -- -- スポーツ属性を趣味に変更する -- alter table 従業員 rename column スポーツ to 趣味 -- -- 従属する属性に変更を加える -- alter table 人物 * rename column 姓 to 家族名 .fi .\"0 .SH "SEE ALSO" .SH "関連項目" create table (l), update (l). .SH 翻訳者 堀田 倫英