Thread: Use lo_creat() when possible instead of lo_create()

Use lo_creat() when possible instead of lo_create()

From
Giovanni Mascellani
Date:
Hi.

I just created a ticket against psycopg2, and Daniele asked me to bring
the issue on the list to open it to a wider audience. The ticket is here:

http://psycopg.lighthouseapp.com/projects/62710/tickets/88-use-lo_creat-when-possible-instead-of-lo_create

For your convenience, I copy the description here:

---
I'm using psycopg2 against a PostgreSQL database replicated using
pgpool-II. On this database I also need large objects support.
Apparently pgpool-II is able to correctly handle lo_creat() calls, but
not lo_create() (see
http://pgpool.projects.postgresql.org/pgpool-II/doc/pgpool-en.html#lobj_lock_table).

Unfortunately, psycopg2 only create large objects with lo_create(), even
when no new_oid is specified. Could you please consider applying the
attached patch, that modifies this behaviour?
---

Please, Cc: me as I'm not subscribed to the list.

Thanks, Giovanni.
--
Giovanni Mascellani <mascellani@poisson.phc.unipi.it>
Pisa, Italy

Web: http://poisson.phc.unipi.it/~mascellani
Jabber: g.mascellani@jabber.org / giovanni@elabor.homelinux.org


Attachment

Re: Use lo_creat() when possible instead of lo_create()

From
Federico Di Gregorio
Date:
On 10/01/12 09:51, Giovanni Mascellani wrote:
> I just created a ticket against psycopg2, and Daniele asked me to bring
> the issue on the list to open it to a wider audience. The ticket is here:
>
> http://psycopg.lighthouseapp.com/projects/62710/tickets/88-use-lo_creat-when-possible-instead-of-lo_create

The patch seems fine to me. Doesn't add any overhead and improves
compatibility with an existing product. I vote +1 [that means "unless
Daniele votes -1 I'll include it" ;)]

federico

Re: Use lo_creat() when possible instead of lo_create()

From
Daniele Varrazzo
Date:
On Tue, Jan 10, 2012 at 10:06 AM, Federico Di Gregorio <fog@dndg.it> wrote:
> On 10/01/12 09:51, Giovanni Mascellani wrote:
>>
>> I just created a ticket against psycopg2, and Daniele asked me to bring
>> the issue on the list to open it to a wider audience. The ticket is here:
>>
>>
>> http://psycopg.lighthouseapp.com/projects/62710/tickets/88-use-lo_creat-when-possible-instead-of-lo_create
>
>
> The patch seems fine to me. Doesn't add any overhead and improves
> compatibility with an existing product. I vote +1 [that means "unless
> Daniele votes -1 I'll include it" ;)]

I don't know much about the difference between the two functions: if
anybody has any interesting story about them I'd be happy to know.
Meanwhile I'll make sure we have tests for both the code paths in the
patch.

-- Daniele

Re: Use lo_creat() when possible instead of lo_create()

From
Daniele Varrazzo
Date:
On Tue, Jan 10, 2012 at 12:18 PM, Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:
> On Tue, Jan 10, 2012 at 10:06 AM, Federico Di Gregorio <fog@dndg.it> wrote:
>> On 10/01/12 09:51, Giovanni Mascellani wrote:
>>>
>>> I just created a ticket against psycopg2, and Daniele asked me to bring
>>> the issue on the list to open it to a wider audience. The ticket is here:
>>>
>>>
>>> http://psycopg.lighthouseapp.com/projects/62710/tickets/88-use-lo_creat-when-possible-instead-of-lo_create
>>
>>
>> The patch seems fine to me. Doesn't add any overhead and improves
>> compatibility with an existing product. I vote +1 [that means "unless
>> Daniele votes -1 I'll include it" ;)]
>
> I don't know much about the difference between the two functions: if
> anybody has any interesting story about them I'd be happy to know.
> Meanwhile I'll make sure we have tests for both the code paths in the
> patch.

I've made some tests and everything seems fine. I've integrated the
patch in my branch.

-- Daniele