summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--psycopg/connection_int.c9
-rw-r--r--psycopg/connection_type.c6
2 files changed, 8 insertions, 7 deletions
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c
index 49daae5..e0a369e 100644
--- a/psycopg/connection_int.c
+++ b/psycopg/connection_int.c
@@ -1189,6 +1189,13 @@ conn_set_session(connectionObject *self, int autocommit,
PGresult *pgres = 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 */
if (self->server_version < 80000) {
if (isolevel == ISOLATION_LEVEL_READ_UNCOMMITTED) {
@@ -1219,7 +1226,7 @@ conn_set_session(connectionObject *self, int autocommit,
goto endlock;
}
}
- if (deferrable != self->deferrable && self->server_version >= 90100) {
+ if (deferrable != self->deferrable) {
if (0 > pq_set_guc_locked(self,
"default_transaction_deferrable", srv_state_guc[deferrable],
&pgres, &error, &_save)) {
diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c
index 66ff705..26100b2 100644
--- a/psycopg/connection_type.c
+++ b/psycopg/connection_type.c
@@ -588,12 +588,6 @@ psyco_conn_set_session(connectionObject *self, PyObject *args, PyObject *kwargs)
}
}
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))) {
return NULL;
}