Backport psycopg2 autocommit fix

I don't know enough to backport the tests over, so I just have to omit them.