Changed all db constructors to newer syntax, made insert_id() function more convenient for postgres on pdo driver
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php
index 3bf065c..ad1c28d 100644
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
@@ -33,7 +33,7 @@
 	 * Grabs the CI super object instance so we can access it.
 	 *
 	 */
-	function CI_DB_Cache(&$db)
+	function __construct(&$db)
 	{
 		// Assign the main CI object to $this->CI
 		// and load the file helper since we use it a lot
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 237a4fc..d7b63b9 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -78,7 +78,7 @@
 	 *
 	 * @param array
 	 */
-	function CI_DB_driver($params)
+	function __construct($params)
 	{
 		if (is_array($params))
 		{
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 0dd29c2..6bc4041 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -35,7 +35,7 @@
 	 * Grabs the CI super object instance so we can access it.
 	 *
 	 */
-	function CI_DB_forge()
+	function __construct()
 	{
 		// Assign the main database object to $this->db
 		$CI =& get_instance();
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index a5f174f..52196b7 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -33,7 +33,7 @@
 	 * Grabs the CI super object instance so we can access it.
 	 *
 	 */
-	function CI_DB_utility()
+	function __construct()
 	{
 		// Assign the main database object to $this->db
 		$CI =& get_instance();
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 08cd27b..bcd7937 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -48,9 +48,9 @@
 	var $_random_keyword;
 
 
-	function CI_DB_odbc_driver($params)
+	function __construct($params)
 	{
-		parent::CI_DB_driver($params);
+		parent::__construct($params);
 
 		$this->_random_keyword = ' RND('.time().')'; // database specific random keyword
 	}
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 568819a..1a84404 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -349,7 +349,25 @@
 	 */
 	function insert_id($name=NULL)
 	{
-		return $this->conn_id->lastInsertId($name);
+		//Convenience method for postgres insertid
+		if(strpos($this->hostname, 'pgsql') !== FALSE)
+		{
+			$v = $this->_version();
+
+			$table	= func_num_args() > 0 ? func_get_arg(0) : NULL;
+
+			if ($table == NULL && $v >= '8.1')
+			{
+				$sql='SELECT LASTVAL() as ins_id';
+			}
+			$query = $this->query($sql);
+			$row = $query->row();
+			return $row->ins_id;
+		}
+		else
+		{
+			return $this->conn_id->lastInsertId($name);
+		}
 	}
 
 	// --------------------------------------------------------------------