Adding an one-out-of-two not null constraint in postgresql

后端 未结 2 1927
小鲜肉
小鲜肉 2020-12-15 16:20

If I have a table in Postgresql:

create table Education ( 
    id                  integer references Profiles(id),
    finished            YearValue not nul         


        
2条回答
  •  萌比男神i
    2020-12-15 17:07

    You can also use a trigger on update and insert to check that a rule is followed before allowing the data into the table. You would normally use this type of approach when the check constraint needs more complicated logic.

提交回复
热议问题