[Koha] Duplicate entry in old_reserves
Tomas Cohen Arazi
tomascohen at gmail.com
Wed Feb 1 08:44:53 NZDT 2017
We need to add ids to old_<tablenames> and have the original id be kept for
historical purposes. As it is not reliable to use auto_increments on InnoDB
the way we use them.
"Switch to Postgres" is not a valid answer, please :-D
El mar., 31 ene. 2017 a las 16:42, Tim McMahon (<tmcmahon at wlpl.org>)
On 01/31/2017 12:37 PM, Jonathan Druart wrote:
> On Tue, 31 Jan 2017 at 18:59 Tim McMahon <tmcmahon at wlpl.org> wrote:
>> Thanks for the quick reply. We've been on Koha since 2006 and the item
>> in question was fairly new, so that wouldn't be it. I agree, the
>> auto-incremement on the reserves key should keep this problem from
> Unfortunately, not at all.
> If you specify an AUTO_INCREMENT column for an InnoDB table, the table
> handle in the InnoDB data dictionary contains a special counter called the
> auto-increment counter that is used in assigning new values for the
> This counter is stored only in main memory, not on disk.
> That means you can get twice the same number if you restart mysql.
> Bug or feature?...
I don't remember restarting MySQL recently, but that doesn't mean for
sure that I didn't. I'm willing to say that it could happen again and
just hope it doesn't. The conflicting reserve_id was from reserves
placed days apart with a few reserves placed between, so that doesn't
look like it would be the cause.
>> On 01/31/2017 11:39 AM, Hugo Agud wrote:
>>> We have seen this when we have migrated data from another ils, the issue
>>> has an auto-incremental id, but old_issues copy the id from the issues,
>>> guess that perhaps it is the same with reserves and old_reserves.
>>> then the question is, have you migrated koha from another ILS and you
>>> migrated historical data on reserves? If yes.. that it should be the
>>> 2017-01-31 18:16 GMT+01:00 Tim McMahon <tmcmahon at wlpl.org>:
>>>> I got an internal server error while checking out a reserved item to a
>>>> The plack-error.log showed this error:
>>>> DBD::mysql::st execute failed: Duplicate entry '4515' for key 'PRIMARY'
>>>> [for Statement "INSERT INTO `old_reserves` ( `biblionumber`,
>>>> `borrowernumber`, `branchcode`, `cancellationdate`, `expirationdate`,
>>>> `found`, `itemnumber`, `itemtype`, `lowestPriority`,
>>>> `priority`, `reminderdate`, `reserve_id`, `reservedate`,
>>>> `suspend`, `suspend_until`, `timestamp`, `waitingdate`) VALUES ( ?, ?,
>>>> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues:
>>>> 0='4095', 1='4310', 2='WLPL', 3=undef, 4=undef, 5='F', 6='4177',
>>>> 8='0', 9=undef, 10=0, 11=undef, 12='4515', 13='2017-01-26', 14='',
>>>> 16=undef, 17='2017-01-26 14:05:25', 18='2017-01-26'] at
>>>> /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.
>>>> DBIx::Class::Storage::DBI::_dbh_execute(): Duplicate entry '4515' for
>>>> 'PRIMARY' at /usr/share/koha/lib/Koha/Object.pm line 120
>>>> I checked in the old_reserves table and found that there was already an
>>>> entry with a reserve_id of 4515.
>>>> Does anyone know how this would happen?
>>>> I'm running Koha 16.11.20.000 on Debian 8 and just updated from
>>>> last Wednesday if that's any help.
>>>> Tim McMahon
>>>> Technical Services
>>>> West Liberty Public Library
>>>> Koha mailing list http://koha-community.org
>>>> Koha at lists.katipo.co.nz
>> Tim McMahon
>> Technical Services
>> West Liberty Public Library
>> Koha mailing list http://koha-community.org
>> Koha at lists.katipo.co.nz
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
West Liberty Public Library
Koha mailing list http://koha-community.org
Koha at lists.katipo.co.nz
Tomás Cohen Arazi
Theke Solutions (https://theke.io <http://theke.io/>)
✆ +54 9351 3513384 <+54%209%20351%20351-3384>
More information about the Koha