Enforce constraint validation

Ok, I'll remove fetchall and write tests.