SPI question: 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: trying to read from Large Objects from within a function
Date: 2004-01-07 02:51:11
Message-ID: 59E53E2E-40BC-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?

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

Browse pgsql-general by date

  From Date Subject
Next Message David Helgason 2004-01-07 03:13:45 SPI question (or not): trying to read from Large Objects from within a function
Previous Message Joshua D. Drake 2004-01-07 02:30:11 Re: Paypal WAS: PostgreSQL speakers needed for OSCON