MySQL Forums
Forum List  »  InnoDB

NOT NULL Constraint not enforced
Posted by: Farhan Khan
Date: November 05, 2007 02:06PM

Hi I am using a MySql 4.1.12 and have found that it doesn't enforces the NOT NULL constraint.

mysql> CREATE TABLE test_table (id SERIAL, name1 VARCHAR(255), name2 VARCHAR(255) NOT NULL) TYPE=INNODB;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> INSERT INTO test_table (name1) VALUES ('dummy_field');
Query OK, 1 row affected (0.00 sec)

mysql> select * from test_table;
+----+-------------+-------+
| id | name1 | name2 |
+----+-------------+-------+
| 1 | dummy_field | |
+----+-------------+-------+
1 row in set (0.00 sec)

Is this a known issue and has anyone else experienced it? Which mysql version has a fix for it? What is the best way to fix it at sql-schema level (without relaxing this NOT-NULL constraint), like trigers etc.

Thanks .. Farhan

Options: ReplyQuote


Subject
Views
Written By
Posted
NOT NULL Constraint not enforced
12400
November 05, 2007 02:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.