Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Bug #9107 currID using wrong method to get last value of sequence
Submitted: 2006-10-20 13:35 UTC
From: mcraig at leadehealth dot com Assigned: lsmith
Status: Closed Package: MDB2 (version 1.2.2)
PHP Version: 4.4.3 OS: linux 2.6
Roadmaps: (Not assigned)    
Subscription  


 [2006-10-20 13:35 UTC] mcraig at leadehealth dot com (Matt Craig)
Description: ------------ This code from "function currID()" in MDB2_Driver_pgsql is using last_value of a sequence which is not connection specific within PostgreSQL: return $this->queryOne("SELECT last_value FROM $sequence_name",'integer'); "last_value" will return the globally unique last value as the whole database sees it. return $this->queryOne("SELECT currval(<seqname>)", 'integer'); is the correct way to get the connection specific Postgres sequence value. This bug was also appearing in DataObject and fixed in this manner as seen in this pear-dev thread: http://www.codecomments.com/message1086631.html

Comments

 [2006-10-20 13:54 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-20 14:12 UTC] mcraig at leadehealth dot com
do you already have a lastInsertID() in mind? Could this use the fix proposed for currID? function lastInsertID($table = null, $field = null) { $sequence_name = $this->quoteIdentifier($this->getSequenceName($table), true); return $this->queryOne("SELECT currval('$sequence_name')", 'integer'); } [darn 60 col textarea]
 [2006-10-20 14:23 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-20 15:06 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-20 15:57 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-20 17:43 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!