I have committed the part of this patch that removes the switch statement in AlterDomainAddConstraint(). That one is dead code.
I'll study the other discussion a bit more. I agree the current code isn't satisfactory.