psycopg2 context manager only available in 2.5