Bug #40960 t/31insertid.t and t/40bindparam2.t do not properly handle auto_increment_offset
Submitted: 23 Nov 2008 23:43 Modified: 20 Feb 2013 22:06
Reporter: Ian Barton Email Updates:
Status: Unsupported Impact on me:
Category:Connectors: DBD::mysql ( Perl ) Severity:S3 (Non-critical)
Version:4.010 OS:Mac OS X
Assigned to: CPU Architecture:Any

[23 Nov 2008 23:43] Ian Barton
Tests 31insertid.t and 40bindparam2.t are failing because they presume the first value assigned to an AUTOINCREMENT primary-key column will always be 1. This behavior is not true when the database has been configured with a value for the auto_increment_offset parameter in /etc/my.cnf.

The module is being built for Perl 5.10.0 on Mac OS X Leopard (10.5.5). The behavior is identical on a MacBook Pro and a Mac Mini.

How to repeat:
On the host that runs the database to be used for testing, add the following lines to the [mysqld] section of /etc/my.cnf

auto_increment_increment = 3
auto_increment_offset    = 2


auto_increment_increment = 3
auto_increment_offset    = 4

Suggested fix:
40bindparam2.t can be made to pass by changing line 46 to be:

   ok ($sth->bind_param(2, $dbh->{mysql_insertid}, SQL_INTEGER()));

However, it appears that the only way to get 31insertid.t to pass right now is to skip test 6 (line 42) altogether. It would appear that there is currently no way to query the host to determine the value of auto_increment_offset.
[2 Dec 2008 8:46] Sveta Smirnova
Thank you for the report.

Verified as described.
[20 Feb 2013 22:06] Sveta Smirnova
Thank you for the report.

We don't work on DBD::mysql bugs anymore. All its bugs should go to CPAN: https://rt.cpan.org/Public/Dist/Display.html?Name=DBD-mysql

I re-submitted your report to https://rt.cpan.org/Public/Bug/Display.html?id=83487
Please subscribe to the new report on CPAN and work with DBD::mysql developers in case if they need additional details.