Bug 12768: make hasContraint schema aware. Thanks to Sven Klemm.