我希望在列上实现一个约束,以确保one特定值只存储在列中一次。
例如,在列值中,我希望有一个约束,使值0只能存储一次。
如何在postgres中实现这一点?
发布于 2016-08-22 02:06:07
创建部分唯一索引:
create table test(col int); create unique index on test (col) where col = 0;
https://stackoverflow.com/questions/39065679
相似问题