Description
Heinrich Hartl
2019-01-14 11:48:50 UTC
Created attachment 89528 [details] [review] Use "DROP USER IF EXISTS" instead of "GRANT USAGE" before "DROP USER". MySQL 5.7 is old, and the latest versions fail on "GRANT USAGE" if the user does not exist. "DROP USER IF EXISTS" has been with us since 5.7, so all users should have it by now. This patch fixes the issue. Created attachment 90081 [details] [review] Bug 22128: Use DROP USER IF EXISTS instead of GRANT USAGE before DROP USAGE MySQL 5.7 is old, and the latest versions fail on "GRANT USAGE" if the user does not exist. "DROP USER IF EXISTS" has been with us since 5.7, so all users should have it by now. This patch fixes the issue. To test: Try to koha_remove a site, and if it works with no errors, all good! Note: I reformatted this patch to community guidelines, and did not test it. I took the intent of the patch, and made it so that it would work. The work is Rudolf's and I have attributed it as such. Koha18.11.05.000 on Debian 9.9 and MariaDB10.1.38 has the same issue $ sudo koha-remove klib Removing Koha instance klib ERROR 1133 (28000) at line 1: Can't find any matching row in the user table Created attachment 90491 [details] [review] Bug 22128: Removed outdated comment Created attachment 90492 [details] [review] Bug 22128: Use DROP USER IF EXISTS instead of GRANT USAGE before DROP USAGE MySQL 5.7 is old, and the latest versions fail on "GRANT USAGE" if the user does not exist. "DROP USER IF EXISTS" has been with us since 5.7, so all users should have it by now. This patch fixes the issue. To test: Try to koha_remove a site, and if it works with no errors, all good! Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Created attachment 90493 [details] [review] Bug 22128: Removed outdated comment Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Created attachment 91063 [details] [review] Bug 22128: Use DROP USER IF EXISTS instead of GRANT USAGE before DROP USAGE MySQL 5.7 is old, and the latest versions fail on "GRANT USAGE" if the user does not exist. "DROP USER IF EXISTS" has been with us since 5.7, so all users should have it by now. This patch fixes the issue. To test: Try to koha_remove a site, and if it works with no errors, all good! Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 91064 [details] [review] Bug 22128: Removed outdated comment Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Nice work! Pushed to master for 19.11.00 Welcome aboard Rudolf, congratulations on your first submission to be pushed to Koha and thank you. Pushed to 19.05.x for 19.05.03 backported to 18.11.x for 18.11.09 Thanks Rudolf! This was a bad push on my part. We still support Debian Jessie (which comes with Mysql5.5 by default) and this breaks our support for Jessie as such... Stretch is also pinned to MySQL5.5 which makes this worse but you can get MariaDB 10.1.4 which resolves it in Stretch (MariaDB supports IF EXISTS from 10.1.3) Not just your fault. I proposed the fix without checking which distributions Koha is supposed to support. We have a conflict between trying to support the old DBs vs the new DBs, because as I mentioned above, the latest versions of MySQL and MariaDB fail on "GRANT USAGE" if the user does not exist, which is problematic. Maybe we should check the MySQL version, and then run the appropriate code in response to that. It's a simple IF statement. One day, when oldstable has moved on to the next release, the old code and the IF statement can simply be removed. In better news.. Jessie drops out of support just after the release of 20.05.. so we won't have to support this for long.. Having said that.. we don't limit people to MariaDB.. so in Stretch they'll still have issues if they want to stick to mysql-server and not myself-server-transitional (which installs mariadb I believe). One for broader discussion there. |