summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-08-15 02:58:36 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-08-15 02:58:36 +0100
commit4458c9b4c94e524237fb39c7821b248fc2a85e35 (patch)
tree086db697de3cdea2903f06abe0914ac597de2337
parentb006190312684679bf03f8b324bade6861f19436 (diff)
parentb3792c7f02c26697dbd32197169cf90cadeef859 (diff)
downloadpsycopg2-4458c9b4c94e524237fb39c7821b248fc2a85e35.tar.gz
Merge branch 'drop-libpq-pre-91'
-rw-r--r--NEWS2
-rw-r--r--doc/src/install.rst3
-rw-r--r--psycopg/adapter_binary.c2
-rw-r--r--psycopg/lobject_int.c4
-rw-r--r--psycopg/lobject_type.c7
-rw-r--r--psycopg/pqpath.c2
-rw-r--r--psycopg/psycopg.h4
-rw-r--r--psycopg/psycopgmodule.c7
-rw-r--r--psycopg/utils.c2
9 files changed, 9 insertions, 24 deletions
diff --git a/NEWS b/NEWS
index d1b9e7d..6ada19c 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,8 @@ New features:
Other changes:
- Dropped support for Python 2.5.
+- Dropped support for client library older than PostgreSQL 9.1 (but older
+ server versions are still supported).
What's new in psycopg 2.6.3
diff --git a/doc/src/install.rst b/doc/src/install.rst
index 674bbac..4611537 100644
--- a/doc/src/install.rst
+++ b/doc/src/install.rst
@@ -19,7 +19,8 @@ The current `!psycopg2` implementation supports:
- Python 2 versions from 2.6 to 2.7
- Python 3 versions from 3.1 to 3.5
-- PostgreSQL versions from 7.4 to 9.4
+- PostgreSQL server versions from 7.4 to 9.5
+- PostgreSQL client library version from 9.1
.. _PostgreSQL: http://www.postgresql.org/
.. _Python: http://www.python.org/
diff --git a/psycopg/adapter_binary.c b/psycopg/adapter_binary.c
index 597048d..1727b19 100644
--- a/psycopg/adapter_binary.c
+++ b/psycopg/adapter_binary.c
@@ -39,11 +39,9 @@ static unsigned char *
binary_escape(unsigned char *from, size_t from_length,
size_t *to_length, PGconn *conn)
{
-#if PG_VERSION_NUM >= 80104
if (conn)
return PQescapeByteaConn(conn, from, from_length, to_length);
else
-#endif
return PQescapeBytea(from, from_length, to_length);
}
diff --git a/psycopg/lobject_int.c b/psycopg/lobject_int.c
index 279ef1e..b954a76 100644
--- a/psycopg/lobject_int.c
+++ b/psycopg/lobject_int.c
@@ -474,8 +474,6 @@ lobject_export(lobjectObject *self, const char *filename)
return retvalue;
}
-#if PG_VERSION_NUM >= 80300
-
RAISES_NEG int
lobject_truncate(lobjectObject *self, size_t len)
{
@@ -510,5 +508,3 @@ lobject_truncate(lobjectObject *self, size_t len)
return retvalue;
}
-
-#endif /* PG_VERSION_NUM >= 80300 */
diff --git a/psycopg/lobject_type.c b/psycopg/lobject_type.c
index d15eb20..ddda0da 100644
--- a/psycopg/lobject_type.c
+++ b/psycopg/lobject_type.c
@@ -266,8 +266,6 @@ psyco_lobj_get_closed(lobjectObject *self, void *closure)
return closed;
}
-#if PG_VERSION_NUM >= 80300
-
#define psyco_lobj_truncate_doc \
"truncate(len=0) -- Truncate large object to given size."
@@ -327,10 +325,8 @@ static struct PyMethodDef lobjectObject_methods[] = {
METH_NOARGS, psyco_lobj_unlink_doc},
{"export",(PyCFunction)psyco_lobj_export,
METH_VARARGS, psyco_lobj_export_doc},
-#if PG_VERSION_NUM >= 80300
{"truncate",(PyCFunction)psyco_lobj_truncate,
METH_VARARGS, psyco_lobj_truncate_doc},
-#endif /* PG_VERSION_NUM >= 80300 */
{NULL}
};
@@ -475,6 +471,3 @@ PyTypeObject lobjectType = {
0, /*tp_alloc*/
lobject_new, /*tp_new*/
};
-
-#endif
-
diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c
index d7283d0..d02cb70 100644
--- a/psycopg/pqpath.c
+++ b/psycopg/pqpath.c
@@ -1913,7 +1913,7 @@ pq_fetch(cursorObject *curs, int no_result)
break;
default:
- /* PGRES_COPY_BOTH, PGRES_SINGLE_TUPLE, future statuses */
+ /* PGRES_SINGLE_TUPLE, future statuses */
Dprintf("pq_fetch: got unsupported result: status = %d pgconn = %p",
pgstatus, curs->conn);
PyErr_Format(NotSupportedError,
diff --git a/psycopg/psycopg.h b/psycopg/psycopg.h
index 3174f30..82b4293 100644
--- a/psycopg/psycopg.h
+++ b/psycopg/psycopg.h
@@ -26,6 +26,10 @@
#ifndef PSYCOPG_H
#define PSYCOPG_H 1
+#if PG_VERSION_NUM < 90100
+#error "Psycopg requires PostgreSQL client library (libpq) >= 9.1"
+#endif
+
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <libpq-fe.h>
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index d4a4c94..012df6b 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -164,7 +164,6 @@ exit:
static PyObject *
psyco_quote_ident(PyObject *self, PyObject *args, PyObject *kwargs)
{
-#if PG_VERSION_NUM >= 90000
PyObject *ident = NULL, *obj = NULL, *result = NULL;
connectionObject *conn;
const char *str;
@@ -204,10 +203,6 @@ exit:
Py_XDECREF(ident);
return result;
-#else
- PyErr_SetString(NotSupportedError, "PQescapeIdentifier not available in libpq < 9.0");
- return NULL;
-#endif
}
/** type registration **/
@@ -285,9 +280,7 @@ psyco_libcrypto_threads_init(void)
if ((m = PyImport_ImportModule("ssl"))) {
/* disable libcrypto setup in libpq, so it won't stomp on the callbacks
that have already been set up */
-#if PG_VERSION_NUM >= 80400
PQinitOpenSSL(1, 0);
-#endif
Py_DECREF(m);
}
else {
diff --git a/psycopg/utils.c b/psycopg/utils.c
index b919180..631b839 100644
--- a/psycopg/utils.c
+++ b/psycopg/utils.c
@@ -67,12 +67,10 @@ psycopg_escape_string(connectionObject *conn, const char *from, Py_ssize_t len,
}
{
- #if PG_VERSION_NUM >= 80104
int err;
if (conn && conn->pgconn)
ql = PQescapeStringConn(conn->pgconn, to+eq+1, from, len, &err);
else
- #endif
ql = PQescapeString(to+eq+1, from, len);
}