What are good ways to add a constraint to PostgreSQL to check that exactly one column (from a set of columns) contains a non-null value?
Update: It is likely th
As hinted by mu is too short:
alter table t add constraint only_one_null check ( (col1 is not null)::integer + (col2 is not null)::integer = 1 )