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

Reply via email to