On Wednesday 22 January 2003 19:24, Valdir Stiebe Junior wrote: > Creating a table with a not null field, and then trying to insert it > doesn't raise an error 'Column XXX cannot be null' > Well, this was the steps (sql to bypass filter) i did: > > 1. create table TEST ( id_test integer, name varchar(50) not null ); > 2. insert into TEST (id_test, name) values (1, 'ppl1'); (ok it works) > 3. insert into TEST (id_test, name) values (2, NULL); (ok raise an error) > 4. insert into TEST (id_test) values (3); (insert a row with name = '') > > This is correct? A bug? Or i'm to worried about raising errors? :)
It's a known behaviour and described here: http://www.mysql.com/doc/en/Bugs.html If you don't specify column explicit in the INSERT statement and column defined as NOT NULL empty string ''(or 0) will be inserted. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php