使用alter table
添加新约束:
alter table foo
add constraint check_positive check (the_column > 0);
More details and examples are in the manual:
http://www.postgresql.org/docs/current/static/sql-altertable.html#AEN70043
Edit个
判断特定值的方式与使用IN
运算符的方式相同:
alter table foo
add constraint check_positive check (some_code in ('A','B'));