Bug 29009

Summary: Attempting to Koha-restore shows unnecessary SQL error
Product: Koha Reporter: Matthew LS <matthew.lindfield-seager>
Component: Installation and upgrade (command-line installer)Assignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: magnus, mikel
Version: 21.05   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Patch (from GitHub - https://github.com/Koha-Community/Koha/pull/42.patch)

Description Matthew LS 2021-09-14 07:45:31 UTC
`koha-restore` command outputs an error about being unable to drop the user:

`ERROR 1396 (HY000) at line 1: Operation DROP USER failed for 'koha_library'@'%'`

This can be avoided by adding `IF EXISTS` to the command (as has been done in [`koha-remove`](https://github.com/Koha-Community/Koha/blob/a5a3a330cfc7c7d6c35db13326745dabf8fe0df3/debian/scripts/koha-remove#L69-70)

Tested on Ubuntu 20.04 LTS with Koha 21.05.02.003 and 21.05.03.001

N.B. This bug was originally filed as a [PR on GitHub](https://github.com/Koha-Community/Koha/pull/42)
Comment 1 Matthew LS 2021-09-14 07:48:07 UTC
Created attachment 124853 [details] [review]
Patch (from GitHub - https://github.com/Koha-Community/Koha/pull/42.patch)
Comment 2 Mike Lake 2021-10-02 06:27:21 UTC
I can confirm that this patch removed that error for me using Debian 11.0 and koha-common 21.05.04-1
Comment 3 Magnus Enger 2023-08-18 08:48:48 UTC
Looks like this was solved by bug 10517.

*** This bug has been marked as a duplicate of bug 10517 ***