moved some exceptions around, pgdb lets you open a cursor on a closed database connection... -_-