public function fetch_from_cursor($cursorname) {
        $count = $this->get_fetch_buffer_size();

        $sql = 'FETCH ' . $count . ' FROM ' . $cursorname;

        $this->query_start($sql, [], SQL_QUERY_AUX);
        $result = pg_query($this->pgsql, $sql);
        $last = pg_num_rows($result) !== $count;

        $this->query_end($result);

        return [$result, $last];
    }