BigW Consortium Gitlab
When trying to run an UPDATE, this query is ran: ```sql UPDATE `todos` INNER JOIN `projects` ON `projects`.`id` = `todos`.`project_id` SET `todos`.`state` = 'done' WHERE `todos`.`user_id` = 4 AND (`todos`.`state` IN ('pending')) AND (EXISTS (SELECT 1 FROM `project_authorizations` WHERE `project_authorizations`.`user_id` = 4 AND (project_authorizations.project_id = projects.id)) OR projects.visibility_level IN (10, 20)) AND `projects`.`id` IN (SELECT `todos`.`project_id` FROM `todos` WHERE `todos`.`user_id` = 4 AND (`todos`.`state` IN ('pending'))) AND (`todos`.`state` != 'done') ``` But MySQL does not like the subquery used to filter on `projects.id IN (SELECT ...` Because the subquery queries from the same table: > Error: You can’t specify target table ‘todos’ for update in FROM clause So as workaround, wrap it in another subquery, where the original subquery is aliased using the `AS` statement. Mostly inspired by https://stackoverflow.com/a/43610081/89376
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
admin | Loading commit data... | |
concerns | Loading commit data... | |
README.md | Loading commit data... | |
access_requests_finder.rb | Loading commit data... | |
branches_finder.rb | Loading commit data... | |
contributed_projects_finder.rb | Loading commit data... | |
environments_finder.rb | Loading commit data... | |
events_finder.rb | Loading commit data... | |
group_finder.rb | Loading commit data... | |
group_members_finder.rb | Loading commit data... | |
group_projects_finder.rb | Loading commit data... | |
groups_finder.rb | Loading commit data... | |
issuable_finder.rb | Loading commit data... | |
issues_finder.rb | Loading commit data... | |
joined_groups_finder.rb | Loading commit data... | |
labels_finder.rb | Loading commit data... | |
members_finder.rb | Loading commit data... | |
merge_requests_finder.rb | Loading commit data... | |
milestones_finder.rb | Loading commit data... | |
move_to_project_finder.rb | Loading commit data... | |
notes_finder.rb | Loading commit data... | |
personal_access_tokens_finder.rb | Loading commit data... | |
personal_projects_finder.rb | Loading commit data... | |
pipeline_schedules_finder.rb | Loading commit data... | |
pipelines_finder.rb | Loading commit data... | |
projects_finder.rb | Loading commit data... | |
snippets_finder.rb | Loading commit data... | |
tags_finder.rb | Loading commit data... | |
todos_finder.rb | Loading commit data... | |
union_finder.rb | Loading commit data... | |
users_finder.rb | Loading commit data... |