using copy_data which is preferred by pg gem

Thanks for the new branch!

Pg gem recommends the use of copy_data in newer versions, because it better handles closing the operation.