From 22db351e648ecc03a9b8fecaf7a064a9463cc330 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Mon, 9 Jan 2012 23:32:36 +0100 Subject: [PATCH] Use lo_creat() instead of lo_create() when creating large objects without new_oid. This enhances the compatibility with the pgpool-II replication middleware, that doesn't support lo_create() calls. --- psycopg/lobject_int.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/psycopg/lobject_int.c b/psycopg/lobject_int.c index e6ad1b6..373aa5f 100644 --- a/psycopg/lobject_int.c +++ b/psycopg/lobject_int.c @@ -175,7 +175,10 @@ lobject_open(lobjectObject *self, connectionObject *conn, if (new_file) self->oid = lo_import(self->conn->pgconn, new_file); else - self->oid = lo_create(self->conn->pgconn, new_oid); + if (new_oid != InvalidOid) + self->oid = lo_create(self->conn->pgconn, new_oid); + else + self->oid = lo_creat(self->conn->pgconn, INV_READ | INV_WRITE); Dprintf("lobject_open: large object created with oid = %d", self->oid); -- 1.7.7.3