In a recent feature I had an object field modelled as:
type Destination = Customer of Customer | Supplier of Supplier | Warehouse of Warehouse
customer_id uuid null , supplier_id uuid null , warehouse_id uuid null , constraint unique_destination check (num_nonnulls(customer_id, supplier_id, warehouse_id) = 1)