Postgresql Add Constraint Foreign Key If Clause Imperative