I just tried something and would a second opinion: I re-configured my MySQL server on my RH Linux machine using the following :
CXXFLAGS=-DDONT_USE_DEFAULT_FIELDS ./configure and ran the following SQL: CREATE TABLE FOO (foo int NOT NULL DEFAULT 5, foo1 INT NULL); INSERT INTO FOO (foo1) VALUES (1); MySQL-Error: ====================== 1048 - Column 'foo' cannot be null. So is it true that you either have an installation of MySQL that will have defaults for NOT NULL defined columns (explicity or implied) or you can have an installation that does not allow default values for NOT NULL defined columns? What I want is to be able to create a table that has columns defined as NOT NULL and if I don't assign a default to that column, I want an error if I don't give it a value on insert. What I DON'T want is to define a column as NOT NULL with NO EXPLICIT DEFAULT to get a value if it is left out of an insert statements list of column/value set. Does this make sense?? ----- Original Message ----- From: "David M. Peak" <[EMAIL PROTECTED]> To: "MySQL List" <[EMAIL PROTECTED]> Sent: Thursday, March 07, 2002 9:22 AM Subject: Changing Default for Not Null to NOTHING > Is there a way for me to NOT have a default value for a column in a table > that I define as NOT NULL? > > EXAMPLE SQL: > > mysql> CREATE TABLE FOO (foo1 int NOT NULL); > Query OK, 0 rows affected (0.05 sec) > > mysql> DESCRIBE FOO; > +-------+---------+------+-----+---------+-------+ > | Field | Type | Null | Key | Default | Extra | > +-------+---------+------+-----+---------+-------+ > | foo1 | int(11) | | | 0 | | > +-------+---------+------+-----+---------+-------+ > 1 row in set (0.00 sec) > > mysql> > > I don't want the default to be 0 (zero).... Any ideas? > > > --------------------------------------------------------------------- > 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