Skip Menu |

This queue is for tickets about the DBIx-LazyMethod CPAN distribution.

Report information
The Basics
Id: 6767
Status: open
Priority: 0/
Queue: DBIx-LazyMethod

Owner: Nobody in particular
Requestors: jonasbn [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

To: bugs-dbix-lazymethod [...]
From: Jonas B.Nielsen <jonasbn [...]>
Subject: Use of OID for Postgres is misleading
Date: Mon, 28 Jun 2004 13:16:54 +0200
Download (untitled) / with headers
text/plain 1.2k
Hi Casper, I am currently working on a database implemented using Postgresql. In order to find out how to get a autoincremented id out (serial in Postgresql) I looked at your code, because I could remember you listed this as a possible return value. As far as I can tell you are using the OID for for this for DBD::Pg. The OID is NOT the autoincremented value of a specified id, but a internal reference number, it is unique but it is not the number which should be returned in this case, hence it is not equal to the autoincremented value. Please see the definition of the OID here: It seems that DBI since 1.38 have specified a method called: last_insert_id, this might be what we need? From DBI POD: -- Returns a value 'identifying' the row just inserted, if possible. Typically this would be a value assigned by the database server to a column with an auto_increment or serial type. Returns undef if the driver does not support the method or can't determine the value. -- Unfortunately it is driver specific and does not seem to be implemented in DBD::Pg currently: Please see: I do not know about DBD::MySQL jonasbn
Download (untitled) / with headers
text/plain 216b
[ - Mon Jun 28 07:16:55 2004]: This link might provide a work-around until the DBD:: drivers are syncronized... jonasbn
Download (untitled) / with headers
text/plain 217b
[JONASBN - Mon Jun 28 07:27:03 2004]: The provided solution does not seem to mention it, but since Postgresql does not seem to implement the lastval as MySQL, you have to subtract 1 from the returned ID. jonasbn

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to