The function must not be called for non managed versioning modes. Check versioning mode before calling the function (Database::versioningMode()).