RE: InnoDB table, NOT NULL question
Ahh, but I didn't enter data that is the point. MySQL definitely knows that I omitted a field, it just happens that MySQL automatically turns the field into an empty string. In the absence of CHECK constraints perhaps the following behavior could be implemented. I would like to see MySQL throw an error if: NOT NULL is specified No DEFAULT is specified The field is omitted from an INSERT Possibly a compatibility switch in the cnf file could turn on such a check. Thanks, Gabe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Harald Fuchs Sent: Wednesday, January 15, 2003 1:23 AM To: [EMAIL PROTECTED] Subject: Re: InnoDB table, NOT NULL question In article [EMAIL PROTECTED], Adolfo Bello [EMAIL PROTECTED] writes: This is wierd. If you define a field as not null is because you want the user to enter some data, for example, First Name and Last Name. Yes, I know one should check it at the application level but, isn't MySQL being a little too flexible with this? You _did_ enter some data, namely a string which just happens to be the empty string (which in turn is different from no data, i.e. NULL). How should MySQL know that you don't want empty strings? Other databases offer check constraints or triggers for that; MySQL still doesn't. [Filter fodder: SQL query] - 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 - 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
RE: NOT NULL question
Thanks, I check it out.. Any idea if this 'deficiency' is scheduled to change? Thanks, Gabe -Original Message- From: Benjamin Pflugmann [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 15, 2003 9:49 AM To: Gabe Geisendorfer Cc: [EMAIL PROTECTED] Subject: Re: NOT NULL question Hello. On Tue 2003-01-14 at 09:32:02 -0800, [EMAIL PROTECTED] wrote: I'm aware that NULL and are not the same thing.. I would like to prevent the column from accepting values automatically ( with out the presence of a DEFAULT). [...] The problem is: You have a DEFAULT, you just don't know it. ;-) Do a SHOW CREATE TABLE stuff, and you'll see what I mean. That is a known deficiency, as Eric told you: 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. http://www.mysql.com/doc/en/configure_options.html describes -DDONT_USE_DEFAULT_FIELDS. HTH, Benjamin. -- [EMAIL PROTECTED] - 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 - 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
RE: InnoDB table, NOT NULL question
Are there plans in future versions to have MySQL fail the below INSERT statement? It would be useful to at least receive a warning. In my situation, I only intend on leaving fields blank by omitting them if: 1. I have set a DEFAULT on the column. 2. Or the column accepts NULL's. Thanks, Gabe -Original Message- From: Egor Egorov [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 7:11 AM To: [EMAIL PROTECTED] Subject: re: InnoDB table, NOT NULL question 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 - 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
RE: InnoDB table, NOT NULL question
I'm aware that NULL and are not the same thing.. I would like to prevent the column from accepting values automatically ( with out the presence of a DEFAULT). -Original Message- From: Csongor Fagyal [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 8:21 AM To: [EMAIL PROTECTED] Subject: Re: InnoDB table, NOT NULL question 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? Well, by empty you probably mean , which is not null, is it? - Csongor - 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 - 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
Availablility of MySQL 4.0.9 for Windows (bins)
Does anyone know when MySQL 4.0.9 for Windows (bins) will be available for download? Thanks, Gabe - 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
InnoDB table, NOT NULL question
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? Thanks, Gabe Geisendorfer - 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