Closed nrainer-materialize closed 11 months ago
This still happens if I execute cursor = connection.cursor()
after the rollback.
Hi @nrainer-materialize, thanks for the bug report, it was really clear. I've made a new release of pg8000, version 1.30.3 which should fix this problem. Now if pg8000 encounters a date that's too big for the Python types, then it returns the date in string form. With pg8000, it can't recover from a failure to parse any incoming data. Anyway, hopefully this fixes your problem, but let me know if there's still something wrong.
Hi @nrainer-materialize, thanks for the bug report, it was really clear. I've made a new release of pg8000, version 1.30.3 which should fix this problem. Now if pg8000 encounters a date that's too big for the Python types, then it returns the date in string form. With pg8000, it can't recover from a failure to parse any incoming data. Anyway, hopefully this fixes your problem, but let me know if there's still something wrong.
This is great! 🎉 Thank you very much for the quick resolution, @tlocke!
Problem
A query with a cursor succeeds in the database but fails in the Python code (due to a parser error). Calling
cursor.fetchall()
after performing first a rollback and then another successful query with the same cursor will fail withattempting to use unexecuted cursor
.Code
Setup
Execution
Output
Outcome
Expected:
cursor.fetchall()
succeeds and contains results Actual:cursor.fetchall()
fails withRemarks
SELECT timestamp_val FROM tbl;
does not succeed due toyear 99999 is out of range: 99999-12-31 23:59:59
but control flow continues.year 99999 is out of range
occurs in the Python code and not in the database. The error is of typedateutil.parser._parser.ParserError
.