The quick and dirty solution is here: http://ellislab.com/forums/viewthread/88548/
Postgresql support "INSERT INTO RETURNING" as correct approach to get primary key value immediately after inserting.
I perform this to get that approach:
$insert_string = $this->db->insert_string($table_name,$post_array);
$insert_string .= ' RETURNING '. $this->db->protect_identifiers($primary_key).' AS last_id';
$query = $this->db->query($insert_string); // <-- here is the problem, $this->db->query return TRUE
The quick and dirty solution is here: http://ellislab.com/forums/viewthread/88548/
Postgresql support "INSERT INTO RETURNING" as correct approach to get primary key value immediately after inserting.
I perform this to get that approach: