Re: Check Constraints in Roadmap?
Jay, thanks so much for your response, which I appreciate and which got me thinking.
Jay Pipes wrote:
> As all features in the MySQL server, you can always
> write your own implementation of check constraints
If I were a C/C++ programmer with time on my hands, that'd be interesting...
But I'm an Electronic Documents Professional (EDP) and web/db programmer...
> I believe it is still considered a nice-to-have :(
E.F. Codd Rule 10: Integrity Independence
The database language should support constraints on user input that maintain database integrity.
Of course, there are interpretations of what kind(s) of integrity is needed, from four general levels:
Entity | Domain | Referential | User-Defined
Data Types are the minimal support for Domain Integrity. In MySQL, ENUM is an attempt to handle ranges, but it's not standard and it's not a boolean expression.
> it's hard to make the case that CHECK CONSTRAINTs are a critical aspect to a database server when they can be abstracted out to the application code layer
Yes, and MySQL users used to say the same thing about Referential Integrity prior to InnoDB--Sure, anything can be abstracted out and you could go back to hacking fixed width files as a programmer...
ISO SQL (and MySQL parsing) does recognize CHECK CONSTRAINTS as a standard method for enforcing domain integrity, and it's used by all major databases. When you talk to DBAs in the field who are looking at migration issues, validation comes up, and MySQL comes up short.
My only idea at this point is to write Stored Functions with boolean expressions for validation called by triggers. That what, they'd be easy to manage for reuse and not junk up the trigger when there's complex business rules running there. It's a workaround, but one that I could implement in my work immediately.