diff --git a/include/class.export.php b/include/class.export.php
index d5d13a2865f8e671e094fb2ad1de10cbba217b99..21e89bf809212a978ec92b83de4a5f9beb647c48 100644
--- a/include/class.export.php
+++ b/include/class.export.php
@@ -278,6 +278,8 @@ class ResultSetExporter {
             $this->keys[] = $field;
         }
         $this->_res = $sql->getIterator();
+        if ($this->_res instanceof IteratorAggregate)
+            $this->_res = $this->_res->getIterator();
         $this->_res->rewind();
     }