#14661: A couple of MySQL/MyISAM test failures
----------------------------------------+-----------------------------------
Reporter: kmtracey | Owner: nobody
Status: new | Milestone: 1.3
Component: Testing framework | Version: 1.2
Resolution: | Keywords: blocker
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
----------------------------------------+-----------------------------------
Comment (by russellm):
I've now diagnosed the other MySQL failure reported by Karen -- the
problem is that MySQL is broken :-)
Exhibit A:
{{{
DROP TABLE IF EXISTS `testapp_tag`;
CREATE TABLE `testapp_tag` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`name` varchar(10) NOT NULL,
`parent_id` integer
);
INSERT INTO `testapp_tag` (`name`, `parent_id`) VALUES ("t1", NULL);
INSERT INTO `testapp_tag` (`name`, `parent_id`) VALUES ("t2", 1);
INSERT INTO `testapp_tag` (`name`, `parent_id`) VALUES ("t3", 1);
INSERT INTO `testapp_tag` (`name`, `parent_id`) VALUES ("t4", 3);
INSERT INTO `testapp_tag` (`name`, `parent_id`) VALUES ("t5", 3);
SELECT `testapp_tag`.`id`, `testapp_tag`.`name`, `testapp_tag`.`parent_id`
FROM `testapp_tag` WHERE NOT ((`testapp_tag`.`id` IN (SELECT U0.`id` FROM
`testapp_tag` U0 LEFT OUTER JOIN `testapp_tag` U1 ON (U0.`id` =
U1.`parent_id`) WHERE U1.`id` IS NULL) AND `testapp_tag`.`id` IS NOT
NULL)) ORDER BY `testapp_tag`.`name` ASC;
SELECT `testapp_tag`.`id`, `testapp_tag`.`name`, `testapp_tag`.`parent_id`
FROM `testapp_tag` WHERE NOT ((`testapp_tag`.`id` IN (SELECT U0.`id` FROM
`testapp_tag` U0 LEFT OUTER JOIN `testapp_tag` U1 ON (U0.`id` =
U1.`parent_id`) WHERE U1.`id` IS NULL) AND `testapp_tag`.`id` IS NOT
NULL)) ORDER BY `testapp_tag`.`name` ASC;
}}}
The last two queries are *identical*. But they yield different results.
The second query is the "right" result.
So - this is a MySQL problem. The SQL for the query is completely correct,
and consistent with the SQL generated for other backends. The same SQL
works for every database *except* MySQL/MyISAM. And if you run the query
twice, the problem "fixes" itself under MySQL/MyISAM.
There's very little we can do (or that I'm willing to do) to catch or work
around this problem in live queries, so I'm going to fix this problem by
adding the dummy query -- that will get the test case to pass, and pass
the responsibility down to MySQL.
--
Ticket URL: <http://code.djangoproject.com/ticket/14661#comment:7>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.