In Ubuntu 20.04.4 LTS mysql Ver 15.1 Distrib 10.4.14-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 ERROR koha-upgrade-schema library Upgrade to 21.12.00.013 [19:25:20]: Bug 29605 - Resync DB structure for existing installations ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry 'ar' for key 'PRIMARY' at /usr/share/koha/lib/C4/Installer.pm line 739
Version Koha 22.05
Hi, We have seen this one only once, on a very old database (started at 3.2). We detect it with : MariaDB [koha]> SELECT language_subtag,GROUP_CONCAT(script_subtag SEPARATOR ' | '),COUNT(*) AS nb\ -> FROM language_script_mapping GROUP BY language_subtag HAVING nb > 1; +-----------------+---------------------------------------------+----+ | language_subtag | GROUP_CONCAT(script_subtag SEPARATOR ' | ') | nb | +-----------------+---------------------------------------------+----+ | ar | Arab | Arab | 2 | | he | Hebr | Hebr | 2 | +-----------------+---------------------------------------------+----+ And fix with : DELETE FROM language_script_mapping WHERE language_subtag = 'ar' LIMIT 1 ; DELETE FROM language_script_mapping WHERE language_subtag = 'he' LIMIT 1 ;
(In reply to Fridolin Somers from comment #2) > Hi, > > We have seen this one only once, on a very old database (started at 3.2). > > We detect it with : > MariaDB [koha]> SELECT language_subtag,GROUP_CONCAT(script_subtag SEPARATOR > ' | '),COUNT(*) AS nb\ > -> FROM language_script_mapping GROUP BY language_subtag HAVING nb > > 1; > +-----------------+---------------------------------------------+----+ > | language_subtag | GROUP_CONCAT(script_subtag SEPARATOR ' | ') | nb | > +-----------------+---------------------------------------------+----+ > | ar | Arab | Arab | 2 | > | he | Hebr | Hebr | 2 | > +-----------------+---------------------------------------------+----+ > > And fix with : > DELETE FROM language_script_mapping WHERE language_subtag = 'ar' LIMIT 1 ; > DELETE FROM language_script_mapping WHERE language_subtag = 'he' LIMIT 1 ; Thank you very much! The issue was resolved with your guidance.
Cheers, Fridolin. Just bumped into this one myself, so your fix was very helpful! I was tempted to close the issue but really this is something that Bug 29605 should've watched out for I suppose... I'm not sure what the answer is for fixing an old database migration... I suppose we would need to fix /usr/share/koha/intranet/cgi-bin/installer/data/mysql/db_revs/211102003.pl since ordering is critical...
Could we fix the old database update and implement the proposed fix as a new one to catch all?
(In reply to Katrin Fischer from comment #5) > Could we fix the old database update and implement the proposed fix as a new > one to catch all? Makes sense to me. I'm just not sure how we do that as a process. Do we do a patch against master for the database update (for the past), and then stable branches backport it?
(In reply to David Cook from comment #6) > (In reply to Katrin Fischer from comment #5) > > Could we fix the old database update and implement the proposed fix as a new > > one to catch all? > > Makes sense to me. I'm just not sure how we do that as a process. Do we do a > patch against master for the database update (for the past), and then stable > branches backport it? I'd say so.
I was looking at this one again... It looks like installer/data/mysql/mandatory/subtag_registry.sql inserts entries into language_script_mapping, and updatedatabase.pl inserts the same entries in version "3.00.00.045". The git history for installer/data/mysql/mandatory/subtag_registry.sql is super weird...
(In reply to David Cook from comment #8) > I was looking at this one again... > > It looks like installer/data/mysql/mandatory/subtag_registry.sql inserts > entries into language_script_mapping, and updatedatabase.pl inserts the same > entries in version "3.00.00.045". Hm, but is this a problem? subtag_registry.sql should only be used for new installations, updatedatabase only run for updates... might be missing something? > The git history for installer/data/mysql/mandatory/subtag_registry.sql is > super weird...
(In reply to Katrin Fischer from comment #9) > Hm, but is this a problem? subtag_registry.sql should only be used for new > installations, updatedatabase only run for updates... might be missing > something? Probably not. I can't figure out how duplicate entries are getting created...
I've tried an upgrade from v3.0.6, then updatedatabase, and the query does not return anything. Lowering severity.
Created attachment 143787 [details] [review] diff to run updatedatabase from v3.0.6
Created attachment 143788 [details] [review] output of updatedatabase from v3.0.6 to 22.06.00.083
For those wondering, see last two attachments.
(In reply to victor from comment #3) > (In reply to Fridolin Somers from comment #2) > > Hi, > > > > We have seen this one only once, on a very old database (started at 3.2). > > > > We detect it with : > > MariaDB [koha]> SELECT language_subtag,GROUP_CONCAT(script_subtag SEPARATOR > > ' | '),COUNT(*) AS nb\ > > -> FROM language_script_mapping GROUP BY language_subtag HAVING nb > > > 1; > > +-----------------+---------------------------------------------+----+ > > | language_subtag | GROUP_CONCAT(script_subtag SEPARATOR ' | ') | nb | > > +-----------------+---------------------------------------------+----+ > > | ar | Arab | Arab | 2 | > > | he | Hebr | Hebr | 2 | > > +-----------------+---------------------------------------------+----+ > > > > And fix with : > > DELETE FROM language_script_mapping WHERE language_subtag = 'ar' LIMIT 1 ; > > DELETE FROM language_script_mapping WHERE language_subtag = 'he' LIMIT 1 ; > > Thank you very much! > The issue was resolved with your guidance. Good day! I tried to use this fix on my KOHA, and the update works. but when i use patron seach on koha web and try to open the patron list it gives an error 500. or when type name of patron on search bar and hit enter it also gives error 500. Thank you!
Its for KOHA version 21.05
(In reply to quickfire28 from comment #15) > (In reply to victor from comment #3) > > (In reply to Fridolin Somers from comment #2) > > > Hi, > > > > > > We have seen this one only once, on a very old database (started at 3.2). > > > > > > We detect it with : > > > MariaDB [koha]> SELECT language_subtag,GROUP_CONCAT(script_subtag SEPARATOR > > > ' | '),COUNT(*) AS nb\ > > > -> FROM language_script_mapping GROUP BY language_subtag HAVING nb > > > > 1; > > > +-----------------+---------------------------------------------+----+ > > > | language_subtag | GROUP_CONCAT(script_subtag SEPARATOR ' | ') | nb | > > > +-----------------+---------------------------------------------+----+ > > > | ar | Arab | Arab | 2 | > > > | he | Hebr | Hebr | 2 | > > > +-----------------+---------------------------------------------+----+ > > > > > > And fix with : > > > DELETE FROM language_script_mapping WHERE language_subtag = 'ar' LIMIT 1 ; > > > DELETE FROM language_script_mapping WHERE language_subtag = 'he' LIMIT 1 ; > > > > Thank you very much! > > The issue was resolved with your guidance. > > Good day! > > I tried to use this fix on my KOHA, and the update works. but when i use > patron seach on koha web and try to open the patron list it gives an error > 500. > > or when type name of patron on search bar and hit enter it also gives error > 500. > > Thank you! I believe these are unrelated - the error you see is unlikely to be linked to the change to languages. Please try the mailing list with a description of your issue.