Bug 32762 - Duplicate entry '10434' for key 'PRIMARY' at /usr/share/koha/lib/C4/Installer.pm line 739
Summary: Duplicate entry '10434' for key 'PRIMARY' at /usr/share/koha/lib/C4/Installer...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (command-line installer) (show other bugs)
Version: 22.11
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
: 33034 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-01-31 06:35 UTC by quickfire28
Modified: 2023-04-19 01:56 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description quickfire28 2023-01-31 06:35:44 UTC
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry '10434' for key 'PRIMARY' at /usr/share/koha/lib/C4/Installer.pm line 739



How to fix this one?
Comment 1 quickfire28 2023-01-31 08:34:12 UTC
for KOHA version 22.05 ( upgrade from 20.05 to 22.05)
Comment 2 Katrin Fischer 2023-01-31 08:59:04 UTC
What are the lines before and after the error? It's easier to see what's going wrong if we have the number of the update.
Comment 3 quickfire28 2023-02-03 01:43:16 UTC
Im not that good in MySQL, can i ask how can i locate the lines before and after the error? the KOHA version im going to update is 20.05( i already fix the first bug i found in my update using this (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 ;)


but after this one the next error bug appears.
(ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry '10434' for key 'PRIMARY' at /usr/share/koha/lib/C4/Installer.pm line 739)

Please help me in finding the error.
Comment 4 quickfire28 2023-02-03 01:44:00 UTC
Im not that good in MySQL, can i ask how can i locate the lines before and after the error? the KOHA version im going to update is 20.05( i already fix the first bug i found in my update using this (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 ;)


but after this one the next error bug appears.
(ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry '10434' for key 'PRIMARY' at /usr/share/koha/lib/C4/Installer.pm line 739)

Please help me in finding the error.
Comment 5 Katrin Fischer 2023-02-03 08:16:30 UTC
What I meant was the lines in the error output. The installer will usually tell you what updates were done and where the error occurred, the database update version, which is the third number, like i.e. 22.04.023, but may it differs when using the web installer and older versions. 

Without a table or anything as a clue, I have no idea what the duplicate key refers to. :(
Comment 6 quickfire28 2023-02-07 04:03:36 UTC


        Added new system preference 'UseOCLCEncodingLevels'
Upgrade to 22.06.00.056  [12:00:42]: Bug 30571 - Table z3950servers: three cols                                                                                                                                                              NOT NULL
Upgrade to 22.06.00.057  [12:00:42]: Bug 29071 - Set HoldsQueueSplitNumbering wh                                                                                                                                                             ere not set
        Added new system preference 'HoldsSplitQueueNumbering'
Upgrade to 22.06.00.058  [12:00:42]: Bug 30944 - Replace branchtransfers.cancell                                                                                                                                                             ation_reason CancelRecall with RecallCancellation
Upgrade to 22.06.00.059  [12:00:42]: Bug 25936 - A password change notification                                                                                                                                                              feature
        Added new letter 'PASSWORD_CHANGE' (email)
        Added new system preference 'NotifyPasswordChange'
Upgrade to 22.06.00.060  [12:00:42]: Bug 10950 - Add preferred pronoun field to                                                                                                                                                              patron record
        Added column 'borrowers.pronouns'
        Added column 'deletedborrowers.pronouns'
        Added column 'borrower_modifications.pronouns'
Upgrade to 22.06.00.061  [12:00:42]: Bug 31333 - Add the ability to limit purcha                                                                                                                                                             se suggestions by patron category
        Added new system preference 'suggestionPatronCategoryExceptions'
Upgrade to 22.06.00.062  [12:00:42]: Bug 27136 - Add missing languages: Cree, Af                                                                                                                                                             rikaans and Multiple languages, Undetermined and No linguistic content
        Added missing languages
Upgrade to 22.06.00.063  [12:00:43]: Bug 31569 - Add primary key for import_bibl                                                                                                                                                             ios
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry '104                                                                                                                                                             34' for key 'PRIMARY' at /usr/share/koha/lib/C4/Installer.pm line 739

Enabling plugins on node rabbit@lrc:
rabbitmq_stomp
The following plugins have been configured:
  rabbitmq_stomp
Applying plugin configuration to rabbit@lrc...
The following plugins have been enabled:
  rabbitmq_stomp

started 1 plugins.
Failed to enable unit: Unit /run/systemd/generator.late/koha-common.service is transient or generated.


Here is the result of upgrade and the error.
Comment 7 quickfire28 2023-02-08 04:42:21 UTC
(In reply to quickfire28 from comment #6)
> 
> 
>         Added new system preference 'UseOCLCEncodingLevels'
> Upgrade to 22.06.00.056  [12:00:42]: Bug 30571 - Table z3950servers: three
> cols                                                                        
> NOT NULL
> Upgrade to 22.06.00.057  [12:00:42]: Bug 29071 - Set
> HoldsQueueSplitNumbering wh                                                 
> ere not set
>         Added new system preference 'HoldsSplitQueueNumbering'
> Upgrade to 22.06.00.058  [12:00:42]: Bug 30944 - Replace
> branchtransfers.cancell                                                     
> ation_reason CancelRecall with RecallCancellation
> Upgrade to 22.06.00.059  [12:00:42]: Bug 25936 - A password change
> notification                                                                
> feature
>         Added new letter 'PASSWORD_CHANGE' (email)
>         Added new system preference 'NotifyPasswordChange'
> Upgrade to 22.06.00.060  [12:00:42]: Bug 10950 - Add preferred pronoun field
> to                                                                          
> patron record
>         Added column 'borrowers.pronouns'
>         Added column 'deletedborrowers.pronouns'
>         Added column 'borrower_modifications.pronouns'
> Upgrade to 22.06.00.061  [12:00:42]: Bug 31333 - Add the ability to limit
> purcha                                                                      
> se suggestions by patron category
>         Added new system preference 'suggestionPatronCategoryExceptions'
> Upgrade to 22.06.00.062  [12:00:42]: Bug 27136 - Add missing languages:
> Cree, Af                                                                    
> rikaans and Multiple languages, Undetermined and No linguistic content
>         Added missing languages
> Upgrade to 22.06.00.063  [12:00:43]: Bug 31569 - Add primary key for
> import_bibl                                                                 
> ios
> ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry
> '104                                                                        
> 34' for key 'PRIMARY' at /usr/share/koha/lib/C4/Installer.pm line 739
> 
> Enabling plugins on node rabbit@lrc:
> rabbitmq_stomp
> The following plugins have been configured:
>   rabbitmq_stomp
> Applying plugin configuration to rabbit@lrc...
> The following plugins have been enabled:
>   rabbitmq_stomp
> 
> started 1 plugins.
> Failed to enable unit: Unit /run/systemd/generator.late/koha-common.service
> is transient or generated.
> 
> 
> Here is the result of upgrade and the error.

I dont know how to check which table is affected with that error in upgrade.
Comment 8 quickfire28 2023-02-22 03:08:16 UTC
Here is the table that has Duplicate entry

 error - {unknown}: dbi exception: dbd::mysql::db do failed: duplicate entry '24690' for key 'import_biblios.primary' at /usr/share/koha/lib/c4/installer.pm line 739


and even the biblios in Reservoir detected as Duplicate entry.
Comment 9 Katrin Fischer 2023-03-15 21:33:38 UTC
*** Bug 33034 has been marked as a duplicate of this bug. ***
Comment 10 quickfire28 2023-04-11 05:39:36 UTC
Still looking for help in this error while upgrading from v20.05 to v22.11.
Comment 11 quickfire28 2023-04-19 01:56:53 UTC
(In reply to quickfire28 from comment #8)
> Here is the table that has Duplicate entry
> 
>  error - {unknown}: dbi exception: dbd::mysql::db do failed: duplicate entry
> '24690' for key 'import_biblios.primary' at
> /usr/share/koha/lib/c4/installer.pm line 739
> 
> 
> and even the biblios in Reservoir detected as Duplicate entry.

I already fixed this error by accessing the database using HeidiSQl then locate and clear the import_biblios table.