From e06a70d0a938279af1677d16f2cd1232f51f05cb Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Wed, 10 Sep 2014 16:31:11 -0400 Subject: [PATCH] Check server_version before using lo_*64 functions. If less tahn 9.3 old none 64bit functions will be use. --- psycopg/lobject_int.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/psycopg/lobject_int.c b/psycopg/lobject_int.c index ce81383b..f1a7726b 100644 --- a/psycopg/lobject_int.c +++ b/psycopg/lobject_int.c @@ -392,7 +392,11 @@ lobject_seek(lobjectObject *self, long pos, int whence) pthread_mutex_lock(&(self->conn->lock)); #if HAVE_LO64 - where = lo_lseek64(self->conn->pgconn, self->fd, pos, whence); + if (self->conn->server_version < 90300) { + where = (long)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence); + } else { + where = lo_lseek64(self->conn->pgconn, self->fd, pos, whence); + } #else where = (long)lo_lseek(self->conn->pgconn, self->fd, (int)pos, whence); #endif @@ -423,7 +427,11 @@ lobject_tell(lobjectObject *self) pthread_mutex_lock(&(self->conn->lock)); #if HAVE_LO64 - where = lo_tell64(self->conn->pgconn, self->fd); + if (self->conn->server_version < 90300) { + where = (long)lo_tell(self->conn->pgconn, self->fd); + } else { + where = lo_tell64(self->conn->pgconn, self->fd); + } #else where = (long)lo_tell(self->conn->pgconn, self->fd); #endif @@ -484,7 +492,11 @@ lobject_truncate(lobjectObject *self, size_t len) pthread_mutex_lock(&(self->conn->lock)); #if HAVE_LO64 - retvalue = lo_truncate64(self->conn->pgconn, self->fd, len); + if (self->conn->server_version < 90300) { + retvalue = lo_truncate(self->conn->pgconn, self->fd, len); + } else { + retvalue = lo_truncate64(self->conn->pgconn, self->fd, len); + } #else retvalue = lo_truncate(self->conn->pgconn, self->fd, len); #endif