On Mon, 9 Apr 2001, Thalis A. Kalfigopoulos wrote:

> This is perfectly normal from Mysql's part. What you call a uniq_id in
> the table where you don't declare it as a unique key is merely another
> int field and a table scan will be performed to actually find ALL the
> occurences of the value you are deleting. On the other hand in the
> case where you actually declare the uniq_id to be unique by building a
> UNIQUE index on it, Mysql will of course use the asserted uniqueness
> and stop processing as soon as the first occurence of the value you
> want to delete is found. I.e. it assumes that as a unique field there
> will not be another occurence of this value. Of course on the other
> hand it allows you to insert multiple cases of NULL even though it is
> a unique field, because NULL is just SO DAMN NULL that it is NOT EVEN
> EQUAL TO ITSELF :-) So when you have a NULL in a unique field and add
> another NULL Mysql will not complain about it cause Null!=Null whereas
> it would complain if you had inserted a '1' and tried to insert
> another '1'.
>
> Clear as mud?
>
> regards,
> thalis

Okay..?

Your explanation makes sense, but it seems a bit counter-intuitive.  In my
mind, if you insert identical values (no matter what they are) into a
field that is declared to be a unique key, the database should complain
like crazy, if not completely disallow the action.

In any case, thanks for the explanation.

- Matt

--
Matt Loschert                           | email: [EMAIL PROTECTED]    |
Software Engineer                       | web:   http://www.servint.net/ |
ServInt Internet Services               | phone: (703) 847-1381          |



---------------------------------------------------------------------
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