SPI question: trying to read from Large Objects from within a function - Mailing list pgsql-general

From David Helgason
Subject SPI question: trying to read from Large Objects from within a function
Date
Msg-id 59E53E2E-40BC-11D8-BF3E-000A9566DA8A@uti.is
Whole thread Raw
List pgsql-general
What:
I'm having trouble finding out how to find the current PGconn
connection inside a C function. Looking through the documentation
didn't give this up. Could anyone suggest where to look?

Why:
I am writing an wrapper around librsync, allowing differential updating
of large amounts of data (librsync wraps the clever algorithm of
rsync).

The first function I'm wrapping is the one which generates a signature
(a hash of each block of data, with some specified block-size) from a
LO. Its signature would be:

    create function rsync_signature(oid /* of an Large Object */) returns
bytea

But I can't figure out how to get the current PGconn to be able to run
the lo_* functions.


Would it btw be possible to avoid using Large Objects, and use TOAST
columns instead? Ie. is it possible to quickly read/write partial toast
columns (I know it's not possible for clients, but on the server
side?).


There may be more questions later, but I'll try to pay back by
submitting the final implementation to contrib/ (if anyone is
interested). It'll allow for really fast incremental updates of a
columns, which I'll use to make storing of huge blobs less of a pain
(although it depends on the client also speaking rsync-ese, but that'll
be included with the package).


Regards,

d.
--
David Helgason
Over the Edge Entertainments


pgsql-general by date:

Previous
From: "Ezra Epstein"
Date:
Subject: Re: Passing a comma delimited list to a function
Next
From: "Ezra Epstein"
Date:
Subject: Re: Anything akin to an Evaluate Statement in Postgresql?