From: | Florian Pflug <fgp(at)phlo(dot)org> |
---|---|
To: | Achim Domma <domma(at)procoders(dot)net> |
Cc: | PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Access to current database from C-language function |
Date: | 2011-07-25 22:40:05 |
Message-ID: | 0AF8F9DC-54B4-44B3-B212-50264E3E8A1D@phlo.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Jul25, 2011, at 22:31 , Achim Domma wrote:
> Am 25.07.2011 um 14:48 schrieb Florian Pflug:
>> A more low-level API is provided by {heap,index}_{beginscan,endscan}, heap_{insert,update,delete} and index_insert. However, correct handling of transactions using this API isn't easy - for example, to update a row you'd first have to find the latest version of that row, then decide if you're allowed to update it, and finally create a new version.
>
> I see the problems with the second approach, but that's definitively what I would like to do.
You're in for a lot of work, then. I still suggest that you explain your ultimate goals before you embark on your endeavor - people might be able to point our easier ways to achieve those.
> But I'm only interested in reading, which will hopefully make it a bit easier.
Maybe. But note that if you want your code to be correct for all transaction isolation level, you have to be quite careful even when only reading. Especially from postgres 9.1 forward, due to the new true serializability feature of that release.
> Could you guide me to a starting point? Assuming my database has a table T with an index I. How do I get access to that index?
I suggest you start by reading nodeIndexScan.c. This is the code the query executor uses to implement index scans. However, before you embark on your endeavor.
best regards,
Florian Pflug
From | Date | Subject | |
---|---|---|---|
Next Message | David Fetter | 2011-07-25 22:47:20 | Re: Update releases |
Previous Message | Jim Nasby | 2011-07-25 22:28:18 | Re: libedit memory stomp is apparently fixed in OS X Lion |