SPI question (or not): trying to read from Large Objects from within a function

From: David Helgason <david(at)uti(dot)is>
To: pgsql-general(at)postgresql(dot)org
Subject: SPI question (or not): trying to read from Large Objects from within a function
Date: 2004-01-07 03:13:45
Message-ID: 8107C1AD-40BF-11D8-BF3E-000A9566DA8A@uti.is
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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? I didn't even
see anything similar to this in the SPI_* documentation. Perhaps I am
totally mislead here?

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.

On another not, would it 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Mc Gee 2004-01-07 04:38:42 Loading a dumped databse from cd
Previous Message David Helgason 2004-01-07 02:51:11 SPI question: trying to read from Large Objects from within a function