Bug 32470

Summary: (Bug 14783 follow-up) Fix mysql error in db_rev for 22.06.000.064
Product: Koha Reporter: Michael Hafen <michael.hafen>
Component: Hold requestsAssignee: Michael Hafen <michael.hafen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P1 - high CC: david, gmcharlt, hannah.co, lucas, tomascohen
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.01
Circulation function:
Bug Depends on: 14783    
Bug Blocks:    
Attachments: Proposed fix
Bug 32470: (Bug 14783 follow-up) Fix mysql error in db_rev for 22.06.000.064

Description Michael Hafen 2022-12-14 18:51:07 UTC
Created attachment 144592 [details] [review]
Proposed fix

The db_rev for 22.06.000.064 throws an error in MySQL:

ERROR 1093 (HY000): You can't specify target table 'systempreferences' for update in FROM clause

Test plan:

install Koha 22.06.0 with db_rev 064 with MySQL database
run koha-upgrade-schema and note MySQL error while processing db_rev 064

apply patch

run koha-upgrade-schema again and note there is no MySQL error for db_rev 064
Comment 1 David Nind 2022-12-16 00:35:19 UTC
I changed the status, as I think it is more than an enhancement.

I will have a go at testing...
Comment 2 David Nind 2022-12-16 00:39:05 UTC
Also (for reference) is a report of this error on the mailing list: https://lists.katipo.co.nz/pipermail/koha/2022-December/058794.html
Comment 3 Tomás Cohen Arazi (tcohen) 2022-12-16 11:38:47 UTC
Created attachment 144669 [details] [review]
Bug 32470: (Bug 14783 follow-up) Fix mysql error in db_rev for 22.06.000.064

Fix MySQL error:
ERROR 1093 (HY000): You can't specify target table 'systempreferences' for
 update in FROM clause

introduced by db_rev 064 for bug 14783.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi (tcohen) 2022-12-16 12:02:27 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 5 Martin Renvoize (ashimema) 2022-12-18 08:22:28 UTC
Nice work everyone!

Pushed to 22.11.x for the next release
Comment 6 Katrin Fischer 2022-12-19 19:41:53 UTC
*** Bug 32497 has been marked as a duplicate of this bug. ***