https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20591 Bug ID: 20591 Summary: DBI->last_insert_id does not work as expected Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org Try the following code: use Koha::Database; use Koha::Cities; use Koha::AuthorisedValues; my $schema = Koha::Database->schema; $schema->storage->txn_begin; my $dbh = C4::Context->dbh; my $city = Koha::City->new({ city_name => 'name' })->store; say $city->cityid; say $dbh->last_insert_id( undef, undef, 'cities', undef ); say $dbh->last_insert_id( undef, undef, 'not_exist', undef ); say "==="; my $av = Koha::AuthorisedValue->new({category => 'LOC', authorised_value => 'just_a_test'})->store; say $av->id; say $dbh->last_insert_id( undef, undef, 'authorised_values', undef ); say $dbh->last_insert_id( undef, undef, 'cities', undef ); say $dbh->last_insert_id( undef, undef, 'not_exist', undef ); It will display: 12 12 12 === 401 401 401 401 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.