[pgsql-jp: 29511] Re: テーブル継承でUNIQUE にならない
sugita @ sra.co.jp
sugita @ sra.co.jp
2003年 3月 30日 (日) 20:08:12 JST
杉田です。
From: MT <akc @ mutt.freemail.ne.jp>
Subject: [pgsql-jp: 29491] テーブル継承でUNIQUE にならない
Date: Thu, 27 Mar 2003 23:07:12 +0900
;;; 初投稿します。MTと申します。PostgreSQL初心者です。
;;;
;;; UNIQUEの設定をしているのにもかかわらず、UNIQUEにならないので、原因を
;;; おしえて下さい。
;;; バージョンは7.1です。
...
;;; 僕の想像では、親テーブルに UNIQUE 指定してあるので、重複して登録しようとすると
;;; エラーになるはずです。実際、メンバーに直接挿入しようとすると、mailに重複する
;;; 要素があれば、エラーで登録できません。
;;;
;;; 子テーブルに親テーブルのUNIQUE 指定を反映させるにはどうすればよいのでしょうか?
マニュアルには、できないと書かれています。
PostgreSQL 7.3 Documentation
Chapter 2. Data Definition
2.5. Inheritance
A limitation of the inheritance feature is that indexes (including unique
constraints) and foreign key constraints only apply to single tables, not
to their inheritance children. Thus, in the above example, specifying that
another table's column REFERENCES cities(name) would allow the other table
to contain city names but not capital names. This deficiency will probably
be fixed in some future release.
TODO にもあります。
* Allow inherited tables to inherit index, UNIQUE constraint, and primary
key, foreign key [inheritance]
Kenji Sugita
pgsql-jp メーリングリストの案内