Re: proposal: lob conversion functionality

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: lob conversion functionality
Date: 2013-09-30 10:22:54
Message-ID: CAFj8pRA5TamsRoTi=63F=oo9kvMemmZLtsr6v9s0jDHLFB1v7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/9/30 Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>

> On 12.08.2013 21:08, Pavel Stehule wrote:
>
>> 2013/8/10 Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>
>>> Pavel Stehule<pavel(dot)stehule(at)gmail(dot)**com <pavel(dot)stehule(at)gmail(dot)com>>
>>> writes:
>>>
>>>> I found so there are no simple API for working with LO from PL without
>>>> access to file system.
>>>>
>>>
>>> What? See lo_open(), loread(), lowrite(), etc.
>>>
>>
>> yes, so there are three problems with these functions:
>>
>> a) probably (I didn't find) undocumented
>>
>
> It's there, although it's a bit difficult to find by searching. See:
> http://www.postgresql.org/**docs/devel/static/lo-funcs.**html<http://www.postgresql.org/docs/devel/static/lo-funcs.html>
> .
>
> I don't actually agree with this phrase on that page:
>
> The ones that are actually useful to call via SQL commands are
>> lo_creat, lo_create, lo_unlink, lo_import, and lo_export
>>
>
> Calling lo_open, loread and lowrite seems equally useful to me.
>
>
> b) design with lo handler is little bit PL/pgSQL unfriendly.
>>
>
> It's a bit awkward, I agree.
>
>
> c) probably there is a bug - it doesn't expect handling errors
>>
>> postgres=# select fbuilder.attachment_to_xml(0);
>> WARNING: Snapshot reference leak: Snapshot 0x978f6f0 still referenced
>> attachment_to_xml
>> ───────────────────
>> [null]
>> (1 row)
>>
>
> Yeah, that's a server-side bug. inv_open() registers the snapshot before
> checking if the large object exists. If it doesn't, the already-registered
> snapshot is not unregistered, hence the warning.
>
> I've committed the attached fix for that bug.
>

nice, I afraid so it is mine bug

thank you

Pavel

>
> - Heikki
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ian Lawrence Barwick 2013-09-30 10:49:00 Re: review: psql and pset without any arguments
Previous Message KONDO Mitsumasa 2013-09-30 10:11:23 Re: Compression of full-page-writes