[CDBI] DBI's last_insert_id and Class::DBI's _auto_increment_value

David Steinbrunner carbon at pobox.com
Mon Nov 21 13:37:59 GMT 2005


For the past several months I have been working on a system that uses MySQL
and Class::DBI.  This has been my first project using Class::DBI while I
have been hand coding queries for MySQL for several years.  I have just
recently decided to make it so that the system works on top of Postgres,

In the process of the getting Postgres working I ran into "Can't get last
insert id".  I immediately did a Google search for last_insert_id and
Class::DBI since I have used last_insert_id in a past database agnostic
system.  I came upon the following:

Class::DBI _auto_increment_value update/suggestion

The discussion in the thread looks good but looking at the
_auto_increment_value method has the following comment:

# the DBI will provide a standard attribute soon, meanwhile...

To get this up and running I went ahead and locally modified
_auto_increment_value to use last_insert_id and I no longer have any issues.

So now I have several questions.

What is the progress on getting _auto_increment_value it use last_insert_id
and released on CPAN?  Is there anything I can do to help make this happen
such as code, testing or the like?

Should I submit a RT bug concerning this issue?

>From my understanding Postgres is a popular enough databases that it would
seem that this type of issue would have been handled by now.  What are other
Postgres users doing regarding this issue?

My database schema relies heavily on auto incrementing primary keys which I
never saw as a problem till I recently read the following from the Handel


"Thanks to Class::DBI and staying away from auto incrementing ids, Handel
should run in any database that Class::DBI supports."

Aside from Class::DBI not using last_insert_id currently and some DBDs not
supporting last_insert_id, are there other concerns that I should be aware
of related to auto incrementing primary keys?


David Steinbrunner

More information about the ClassDBI mailing list