mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-30 04:33:45 +03:00
Check for deferrable unsupported applied to attribute too
This commit is contained in:
parent
d50ed48807
commit
d7bba865f3
|
@ -1189,6 +1189,13 @@ conn_set_session(connectionObject *self, int autocommit,
|
||||||
PGresult *pgres = NULL;
|
PGresult *pgres = NULL;
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
|
|
||||||
|
if (deferrable != self->deferrable && self->server_version < 90100) {
|
||||||
|
PyErr_SetString(ProgrammingError,
|
||||||
|
"the 'deferrable' setting is only available"
|
||||||
|
" from PostgreSQL 9.1");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
/* Promote an isolation level to one of the levels supported by the server */
|
/* Promote an isolation level to one of the levels supported by the server */
|
||||||
if (self->server_version < 80000) {
|
if (self->server_version < 80000) {
|
||||||
if (isolevel == ISOLATION_LEVEL_READ_UNCOMMITTED) {
|
if (isolevel == ISOLATION_LEVEL_READ_UNCOMMITTED) {
|
||||||
|
@ -1219,7 +1226,7 @@ conn_set_session(connectionObject *self, int autocommit,
|
||||||
goto endlock;
|
goto endlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (deferrable != self->deferrable && self->server_version >= 90100) {
|
if (deferrable != self->deferrable) {
|
||||||
if (0 > pq_set_guc_locked(self,
|
if (0 > pq_set_guc_locked(self,
|
||||||
"default_transaction_deferrable", srv_state_guc[deferrable],
|
"default_transaction_deferrable", srv_state_guc[deferrable],
|
||||||
&pgres, &error, &_save)) {
|
&pgres, &error, &_save)) {
|
||||||
|
|
|
@ -588,12 +588,6 @@ psyco_conn_set_session(connectionObject *self, PyObject *args, PyObject *kwargs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Py_None != deferrable) {
|
if (Py_None != deferrable) {
|
||||||
if (self->server_version < 90100) {
|
|
||||||
PyErr_SetString(ProgrammingError,
|
|
||||||
"the 'deferrable' setting is only available"
|
|
||||||
" from PostgreSQL 9.1");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (0 > (c_deferrable = _psyco_conn_parse_onoff(deferrable))) {
|
if (0 > (c_deferrable = _psyco_conn_parse_onoff(deferrable))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user