Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 15918
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: orentocy [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 1.43
  • 1.43_1
Fixed in: 2.0.0



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) {
From: orentocy [...] gmail.com
[guest - Fri Nov 18 00:30:45 2005]: Show quoted text
> 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:
Should be DBD-Pg 1.43 Show quoted text
> > --- 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) {
For DBD-Pg 1.43_1: --- Pg.pm.orig 2005-11-18 07:54:39.000000000 -0500 +++ Pg.pm 2005-11-18 07:54:57.000000000 -0500 @@ -275,8 +275,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) {