Fixes for constraint creation

Fixes the generation of check constraints when altering or creating tables.