final function GetLastID($offset = 0, $seq_suffix = 'seq')
    {
        $regs = array();
        preg_match("/insert\\s*into\\s*\"?(\\w*)\"?/i", $this->last_query, $regs);

        if (count($regs) > 1) {
            $table_name = $regs[1];
            $res = @pg_query($this->conn, "SELECT * FROM $table_name WHERE 1 != 1");
            $query_for_id = "SELECT CURRVAL('{$table_name}_".@pg_field_name($res, $offset)."_{$seq_suffix}'::regclass)";
            $result_for_id = @pg_query($this->conn, $query_for_id);

            $last_id = @pg_fetch_array($result_for_id, 0, PGSQL_NUM);
            return $last_id[0];
        }
        return null;
    }