Bug #4140 | The UNIQUE key error when null | ||
---|---|---|---|
Submitted: | 15 Jun 2004 11:30 | Modified: | 15 Jun 2004 19:07 |
Reporter: | Haitao Jiang | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 4.1.x | OS: | Linux (Linux) |
Assigned to: | Sergei Golubchik | CPU Architecture: | Any |
[15 Jun 2004 11:30]
Haitao Jiang
[15 Jun 2004 19:07]
Sergei Golubchik
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.mysql.com/documentation/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php Additional info: This is the correct behaviour. Oracle does it wrong. Indeed, you cannot say that LDD column contain identical values, because "NULL=NULL" is not true. Also, the SQL standard explicitly dictates the behaviour that we have implemented: 2) If there are no two rows in T such that the value of each column in one row is non-null and is not distinct from the value of the corresponding column in the other row, then the result of the <unique predicate> is True; otherwise, the result of the <unique predicate> is False. (the text above is for <unique predicate> not for <unique constraint>, but it's because the standard defines <unique constraint> via <unique predicate> - so I skipped intermediate steps for brevity)