Thursday, January 26, 2006

Emulating check constraints with views?

This blog post has moved. Please find it at:

http://www.mpopp.net/2006/01/emulating-check-constraints-with-views/.

2 comments:

Anonymous said...

The first case definitely looks like a bug. If you do the same thing with a BETWEEN, it will be rejected.

root@test~> CREATE OR REPLACE VIEW v_checktest AS SELECT id, val FROM checktest WHERE val BETWEEN 1 AND 5 WITH CHECK OPTION;
Query OK, 0 rows affected (0.02 sec)

root@test~> UPDATE v_checktest SET val=6 WHERE id=1;
ERROR 1369 (HY000): CHECK OPTION failed 'test.v_checktest'


The second thing, cascaded is the default, so even if you don't define it, it will still be there, so not a bug on that case.

Markus Popp said...

Thank you - I have filed a bug report about it: http://bugs.mysql.com/bug.php?id=16813