|
[
Permalink
| « Hide
]
Nicolas Connault added a comment - 05/Apr/07 02:54 PM
Another enrol one.
I have been looking into this, and it is my feeling that the LEFT JOIN statement is theoretically correct, but the problem (in my case, anyway) is that versions pf MySQL before 5.0.1 do not support nested joins. Here we have a command of the form
SELECT * FROM RA LEFT JOIN (C, CN) And this is a form that explicitly not allowed in MySQL prior to 5.0.1. Basically, these versions of MySQL will just ignore the parentheses. That's what's resulting in this behavior. Since Moodle is supposed to support MySQL 4.1, the query will have to be rewritten. I think a query of the form SELECT * FROM RA LEFT JOIN CN LEFT JOIN C That is, "SELECT ra.roleid, ra.userid, ra.contextid will do what was intended here, though it may not be formally equivalent. Hmm, Martin is this still a problem?
there is a bug in Mysql 5.0.3a. to get details plz visit http://bugs.mysql.com/bug.php?id=25575
It is indeed still a problem. I should have looked here first :-/ Serves me right...
I am using a version of mysql prior to 5.0.1.... I'll take a look at what C. Lopez has suggested.. http://moodle.org/mod/forum/discuss.php?d=94586 ns Well,
IMO that script shouldn't try to "fix" (or clean) enrolments in orphan contexts or courses (that's another problem out from the database enrol itself). So I've transformed the problematic query into one common INNER JOIN so it simply returns the role assignments in moodle courses that aren't any more in external DB. Just that. I haven't tested code (patch attached for Moodle 1.9) but should work fine, AFAIK. If somebody can test it I'll commit it to as many releases as possible. TIA and ciao my +1, but did not test it either
Thanks for feedback, Petr!
Can anybody apply the patch above against 1.9 and check it fixes the "exceed of deletions" problem? TIA and ciao Initial patch has an extra '(' character on the first JOIN line. This simply fixes that. --ns
I tested the fix (quickly - not extensively) and it works perfectly once the extra '(' is removed.
Thanks! Cool, you really tested it, Neil!
Going to apply the (fixed) patch to 18_STABLE, 19_STABLE and HEAD: Thanks for feedback! Ciao Done patch has been applied to 18_STABLE, 19_STABLE and HEAD.
Resolving as fixed. Thanks and ciao |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||