mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #65615
[Bug 1967811] Re: SQL vs MySQL on group table update
Bob spotted that MySQL has some weird behaviour when it comes to reading
and writing to the same table. This method gets around that though;
execute_sql("
UPDATE {group}
SET submittableto = 1
WHERE id IN ((
SELECT foo.id FROM (
SELECT g1.id
FROM {lti_assessment} l
JOIN {group} g1 ON g1.id = l.group
WHERE g1.submittableto = 0
) AS foo
));");
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/1967811
Title:
SQL vs MySQL on group table update
Status in Mahara:
New
Bug description:
I was switching DBs for ES7 testing on a smaller dataset. The smaller db is on MySQL. During the site upgrade I got this:
```
[DBG] 66 (lib/dml.php:180) mysqli error: [1093: You can't specify target table 'group' for update in FROM clause] in EXECUTE("
UPDATE "group" SET submittableto = 1 WHERE id IN (
SELECT g1.id FROM "lti_assessment" l
JOIN "group" g1 ON g1.id = l.group
WHERE g1.submittableto = 0
)")Command was:
UPDATE "group" SET submittableto = 1 WHERE id IN (
SELECT g1.id FROM "lti_assessment" l
JOIN "group" g1 ON g1.id = l.group
WHERE g1.submittableto = 0
)
```
This is related to this review:
https://reviews.mahara.org/c/mahara/+/12492
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1967811/+subscriptions
References