Wednesday, February 16, 2011

PostgreSQL - current transaction is aborted, commands ignored until end of transaction block

When running SQL against PostgreSQL, I sometimes stuff up my SQL and get an error. I can't just fix my SQL and re-run the query though: I get this error instead:

ERROR: current transaction is aborted, commands ignored until end of transaction block
[SQL State: 25P02]

I have found two ways around this. Either disconnect and re-connect to clear this error, or run the command rollback;