CHECK制約

 CREATE TABLE t1 ( gender TEXT CHECK ( gender IN ( 'man', 'woman' ) ) );
   => genderカラムにCHECK制約を設定
  
 INSERT INTO t1 VALUES ( 'man' );
   => OK
 
 INSERT INTO t1 VALUES ( 'woman' );
   => OK
 INSERT INTO t1 VALUES ( 'foo' );
 ERROR:  new row for relation "t1" violates check constraint "t1_gender_check"
 DETAIL:  Failing row contains (foo).

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS