Subject: | last_insert_id works with PG 8.0.x but not with PG 8.1.0 |
Use DBD::Pg with Class::DBI::Loader in Catalyst, Perl 5.8.5 threaded CentOS 4.2 Linux kernek version 2.6.14-cks5 PG 8.1.0
It's easy to reprocude this bug, just create a table with an sequential primary key, insert a record then get last_insert_id, you will get nothing, this is due to PG 8.1.0 has new format for the sequence.
Patch against DBD-Pg 1.48:
--- Pg.pm.orig 2005-11-18 00:20:44.000000000 -0500
+++ Pg.pm 2005-11-18 00:21:20.000000000 -0500
@@ -289,8 +289,8 @@
## We have at least one with a default value. See if we can determine sequences
my @def;
for (@$info) {
- next unless $_->[2] =~ /^nextval\('([^']+)'::/o;
- push @$_, $1;
+ next unless $_->[2] =~ /^nextval(\()+'([^']+)'::/o;
+ push @$_, $2;
push @def, $_;
}
if (!@def) {