QuickBooks/Driver/Sql/Pgsql.php
public function last()
	{
        $errnum = 0;
        $errmsg = '';
        
        // get the current table's primary key
        $sql = "SELECT               
                pg_attribute.attname, 
                format_type(pg_attribute.atttypid, pg_attribute.atttypmod) 
            FROM pg_index, pg_class, pg_attribute 
            WHERE 
                pg_class.oid = '" . $this->last_insert_table . "'::regclass AND
                indrelid = pg_class.oid AND
                pg_attribute.attrelid = pg_class.oid AND 
                pg_attribute.attnum = any(pg_index.indkey)
                AND indisprimary";
        
        $res = $this->query($sql, $errnum, $errmsg);
        
        $sequence = pg_fetch_result($res, 0, 0);
        
        // get the last ID
        $sql = "select currval(pg_get_serial_sequence('" . $this->last_insert_table . "', '" . $sequence . "'));";
        
        $res = $this->query($sql, $errnum, $errmsg);
        
        $last_insert_id = pg_fetch_result($res, 0, 0);
        
		return $last_insert_id;
	}
public function last()
	{
        $errnum = 0;
        $errmsg = '';
        
        // get the current table's primary key
        $sql = "SELECT               
                pg_attribute.attname, 
                format_type(pg_attribute.atttypid, pg_attribute.atttypmod) 
            FROM pg_index, pg_class, pg_attribute 
            WHERE 
                pg_class.oid = '" . $this->last_insert_table . "'::regclass AND
                indrelid = pg_class.oid AND
                pg_attribute.attrelid = pg_class.oid AND 
                pg_attribute.attnum = any(pg_index.indkey)
                AND indisprimary";
        
        $res = $this->query($sql, $errnum, $errmsg);
        
        $sequence = pg_fetch_result($res, 0, 0);
        
        // get the last ID
        $sql = "select currval(pg_get_serial_sequence('" . $this->last_insert_table . "', '" . $sequence . "'));";
        
        $res = $this->query($sql, $errnum, $errmsg);
        
        $last_insert_id = pg_fetch_result($res, 0, 0);
        
		return $last_insert_id;
	}
Tell the last inserted AUTO_INCREMENT value

@return integer