Bug #12340 | multitable delete deletes only one record | ||
---|---|---|---|
Submitted: | 3 Aug 2005 9:02 | Modified: | 16 Aug 2005 3:31 |
Reporter: | [ name withheld ] | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.0.10a (Innodb) | OS: | Any (*) |
Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
[3 Aug 2005 9:02]
[ name withheld ]
[3 Aug 2005 14:12]
Aleksey Kishkin
mysql> select * from PROPERTIES \G *************************** 1. row *************************** VERSION_ID: 1 PROPERTY_NAMESPACE: DAV: PROPERTY_NAME: creationdate PROPERTY_VALUE: 2005-08-03T08:05:16Z PROPERTY_TYPE: IS_PROTECTED: 1 *************************** 2. row *************************** VERSION_ID: 1 PROPERTY_NAMESPACE: DAV: PROPERTY_NAME: modificationdate PROPERTY_VALUE: 2005-08-03T08:05:16Z PROPERTY_TYPE: IS_PROTECTED: 1 2 rows in set (0.00 sec) mysql> select p.* from PROPERTIES p, VERSION_HISTORY vh, URI u where p.VERSION_ID = vh.VERSION_ID and vh.REVISION_NO = '1.0' and vh.URI_ID = u.URI_ID AND u.URI_STRING = '/'\G *************************** 1. row *************************** VERSION_ID: 1 PROPERTY_NAMESPACE: DAV: PROPERTY_NAME: creationdate PROPERTY_VALUE: 2005-08-03T08:05:16Z PROPERTY_TYPE: IS_PROTECTED: 1 *************************** 2. row *************************** VERSION_ID: 1 PROPERTY_NAMESPACE: DAV: PROPERTY_NAME: modificationdate PROPERTY_VALUE: 2005-08-03T08:05:16Z PROPERTY_TYPE: IS_PROTECTED: 1 2 rows in set (0.00 sec) delete p.* from PROPERTIES p, VERSION_HISTORY vh, URI u where p.VERSION_ID = vh.VERSION_ID and vh.REVISION_NO = '1.0' and vh.URI_ID = u.URI_ID AND u.URI_STRING = '/'\G Query OK, 1 row affected (0.05 sec) mysql> select * from PROPERTIES \G *************************** 1. row *************************** VERSION_ID: 1 PROPERTY_NAMESPACE: DAV: PROPERTY_NAME: modificationdate PROPERTY_VALUE: 2005-08-03T08:05:16Z PROPERTY_TYPE: IS_PROTECTED: 1 1 row in set (0.00 sec)
[9 Aug 2005 17:56]
Evgeny Potemkin
When PRIMARY KEY is present ha_innobase::cmp_ref() uses it to compare refs. After comparing part of key it moves pointers to compare next part. For varchar parts pointers were moved only by length of parts, not including bytes containig part length itself. This results in wrong comparision and wrong number of deleted records.
[9 Aug 2005 18:03]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/28081
[9 Aug 2005 20:43]
Evgeny Potemkin
Fixed in 5.0.12, cset 1.1963.1.1
[16 Aug 2005 3:31]
Mike Hillyer
Documented in 5.0.12 changelog: <listitem><para> Comparison of InnoDB multi-part primary keys that include <literal>VARCHAR</literal> columns could produce incorrect results. (Bug #12340) </para></listitem>