create unique index idx on t (( case when c1 is null and c2 is null then null when c1 is null and c2 is not null then '{c2}' when c1 is not null and c2 is null then '{c1}' else '{c1,c2}' end));
I'm not sure what your '{c1}' syntax means but I'll take it you are suggesting to construct an array. This seems to fail quite easily if the values of c1 and c2 overlap.