Re: Seek within Large Object, within PL/* function?

From: Adam Seering <aseering(at)gmail(dot)com>
To: Klint Gore <kgore4(at)une(dot)edu(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Seek within Large Object, within PL/* function?
Date: 2008-11-15 18:38:47
Message-ID: 491F1737.4090202@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Klint Gore wrote:
>> I'm playing around with storing custom preprocessed data
>> structures within Large Objects. I'd like to be able to write a
>> custom function that will, within a query, let me select out
>> particular bytestrings from the middle of a Large Object (within C, I
>> think 'lo_lseek' and 'lo_read' would get me what I want).
>>
> According to http://www.postgresql.org/docs/8.3/static/lo-funcs.html ,
> the functions are server side too

Thanks for the link; still trying to figure out how to use these
functions, though.

The link that you sent suggests that these commands are really only
useful for writing out data to server-side files, which isn't so much
what I want. What I really want is to lo_open a file, then lo_lseek to
a particular address and loread a constant number of bytes (to be
returned as the query result), then lo_close the file.

I'm currently stuck on the easy part: lo_open always returns 0, which
gives me "ERROR: invalid large-object descriptor: 0" when I try to use
it with loread.

Any further thoughts?

Thanks,
Adam

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2008-11-15 19:36:37 Re: Seek within Large Object, within PL/* function?
Previous Message Tom Lane 2008-11-15 17:12:25 Re: Delete cascade trigger runs security definer