mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-14 21:16:34 +03:00
Autocommit shouldn't change deferrable on servers not supporting it
Regression on unsupported Postgres versions after fixing bug #580
This commit is contained in:
parent
c52e49a9da
commit
5309da117d
|
@ -1194,7 +1194,7 @@ conn_set_session(connectionObject *self, int autocommit,
|
||||||
int want_autocommit = autocommit == SRV_STATE_UNCHANGED ?
|
int want_autocommit = autocommit == SRV_STATE_UNCHANGED ?
|
||||||
self->autocommit : autocommit;
|
self->autocommit : autocommit;
|
||||||
|
|
||||||
if (deferrable != self->deferrable && self->server_version < 90100) {
|
if (deferrable != SRV_STATE_UNCHANGED && self->server_version < 90100) {
|
||||||
PyErr_SetString(ProgrammingError,
|
PyErr_SetString(ProgrammingError,
|
||||||
"the 'deferrable' setting is only available"
|
"the 'deferrable' setting is only available"
|
||||||
" from PostgreSQL 9.1");
|
" from PostgreSQL 9.1");
|
||||||
|
@ -1256,7 +1256,7 @@ conn_set_session(connectionObject *self, int autocommit,
|
||||||
goto endlock;
|
goto endlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self->deferrable != STATE_DEFAULT) {
|
if (self->server_version >= 90100 && self->deferrable != STATE_DEFAULT) {
|
||||||
if (0 > pq_set_guc_locked(self,
|
if (0 > pq_set_guc_locked(self,
|
||||||
"default_transaction_deferrable", "default",
|
"default_transaction_deferrable", "default",
|
||||||
&pgres, &error, &_save)) {
|
&pgres, &error, &_save)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user