On Monday 13 January 2003 23:38, Gabe Geisendorfer wrote:
> Hello, I'm in the process of moving from Postgres to MySQL and I have a
> question.
> +How do you prevent a field from being left empty?
>
> I have an InnoDB table that looks like the following.
>
> CREATE TABLE `stuff` (
> `stuff_id` int(11) NOT NULL auto_increment,
> `somevalue1` varchar(35) NOT NULL,
> `somevalue2` varchar(35) NOT NULL,
> PRIMARY KEY (`stuff_id`)
> ) TYPE=InnoDB COMMENT='stuff table';
>
> I run the following insert statement.
>
> INSERT INTO stuff ( somevalue2 ) VALUES ('blah')
>
> Now the field "somevalue1" is empty. Doesn't this violate the NOT NULL
> constraint on the field?
It's a known behaviour and is described in the MySQL manual:
http://www.mysql.com/doc/en/Bugs.html
You can change it if you compile MySQL server with -DDONT_USE_DEFAULT_FIELDS
option. But in this case you can't use default values at all.
--
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