You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following was reported against 2.5.4 by a Debian user. I've inspected the code in 2.6 and it's the same.
Subject: [python-psycopg2] extensions.ISOLATION_LEVEL_AUTOCOMMIT should disappear
Or at the very least, doc should clearly state that it MUST NOT
be used into 'set_session()')'.
Because issuing:
connection.set_session(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT,
readonly=True, deferrable=False, autocommit=True)
fails with the following message:
ValueError: isolation_level must be between 1 and 4
(œuf corse, as psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT == 0)
I did look at the code that triggers this, psycopg/connection_type.c line 460 in 2.6, and I think it should be:
if (level < 0 || level > 4) {
and the error message two lines later adjusted as well. It looks like this code was added in:
and then never revisited. That said, I'm not that familiar with it and autocommit may not be appropriate here, in which case the documentation should be updated to mention this.
The text was updated successfully, but these errors were encountered:
extensions.ISOLATION_LEVEL_AUTOCOMMIT cannot disappear because it is used by the older method set_isolation_level. It has never meant to be supported as isolation_level by set_session() (it is not an isolation level and most definitely not used by the server: it only changes the client-side behaviour of the connection).
We will improve the docs for set_session() making clear that only the other constants are accepted for the parameter. Thank you for the report.
The following was reported against 2.5.4 by a Debian user. I've inspected the code in 2.6 and it's the same.
Subject: [python-psycopg2] extensions.ISOLATION_LEVEL_AUTOCOMMIT should disappear
Or at the very least, doc should clearly state that it MUST NOT
be used into 'set_session()')'.
Because issuing:
connection.set_session(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT,
readonly=True, deferrable=False, autocommit=True)
fails with the following message:
ValueError: isolation_level must be between 1 and 4
(œuf corse, as psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT == 0)
I did look at the code that triggers this, psycopg/connection_type.c line 460 in 2.6, and I think it should be:
if (level < 0 || level > 4) {
and the error message two lines later adjusted as well. It looks like this code was added in:
ea03ffb
and then never revisited. That said, I'm not that familiar with it and autocommit may not be appropriate here, in which case the documentation should be updated to mention this.
The text was updated successfully, but these errors were encountered: