[pgsql-jp: 28613] Re: INHERITS による継承について
Kenji Ono
ono @ fjct.fujitsu.com
2003年 1月 9日 (木) 19:44:52 JST
杉村さん今日は。小野です。
7.3.1でもなるのは厳しいですね。
確かにこれでは使えません。
やっぱり「inherits」はあきらめます。
> テーブル t1 と t1 と継承した t2 を作成
>
> test01=# create table t1 (c1 text primary key);
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 't1_pkey' for tab
> le 't1'
> CREATE TABLE
> test01=# create table t2 (c2 text) inherits (t1);
> CREATE TABLE
> test01=#
>
> t2 に対して 同じデータを登録してみると、、
>
> test01=# insert into t2 (c1, c2) values ('foo','bar');
> INSERT 4778765 1
> test01=# insert into t2 (c1, c2) values ('foo','bar');
> INSERT 4778766 1
> test01=# select * from t1;
> c1
> -----
> foo
> foo
> (2 rows)
>
> test01=#
>
> c1 には PRIMARY KEY を設定しているのに登録できてしまいます。
>
> # Solaris 8 + PostgreSQL 7.3.1 (+ readline 4.2a)
pgsql-jp メーリングリストの案内