Case #4243 - make export in batches work with postgres