[postgresql] PSQLException: current transaction is aborted, commands ignored until end of transaction block

In my case i was getting this error because my file was corrupt. While iterating the records of files it was giving me the same error.

May be in future it will help to anyone. That's the only reason to post this answer.