constraints and sql completion