1

The MySQL Reference Manual says:

The CHECK clause is parsed but ignored by all storage engines.

No mistake. I've read that over 10 times.

So what's the whole point of writing check constraints then?

Emre Yazici
  • 10,136
  • 6
  • 48
  • 55
Yony
  • 95
  • 5
  • 3
    The real question is: why does MySQL still not support them... –  Jul 09 '11 at 18:03
  • possible duplicate of [check constraint in mysql not working](http://stackoverflow.com/questions/2115497/check-constraint-in-mysql-not-working) and others – gbn Jul 09 '11 at 19:35

3 Answers3

4

It's there because of interoperability concerns. You can for example import an SQL script that is generated by other RDBMSs that support CHECK constraint (say Oracle).

Emre Yazici
  • 10,136
  • 6
  • 48
  • 55
0

There is no point. I think they prepared the database to accept check constraints by adding support for them in the SQL parser but none of the engines still support them.

0

It's been a bug report for over 7 years.

http://bugs.mysql.com/bug.php?id=3464

Personal opinion: another reason not to use MySQL, like NATURAL JOIN (and again) and random aggregates

Community
  • 1
  • 1
gbn
  • 422,506
  • 82
  • 585
  • 676