Improve check constraint implementation