Re: How do I use the backend APIs

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Chad <chadzakary(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How do I use the backend APIs
Date: 2006-02-17 09:21:04
Message-ID: 20060217092104.GB9254@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 16, 2006 at 07:41:09AM -0800, Chad wrote:
> Hi,
>
> In Postgres, is there a C language API which would give me access to
> BTrees like Berkeley DB does? eg to seek to a particular key/value pair
> and iterate forward from there? If not whats the nearest thing to this
> in Postgres?

Well, in the backend you can do things like open a btree index, setup
an ScanKey to indicate which values you want and then keep calling
getnext(). If you set your scankey to (col1 >= 'A') it will start at
'A' and go up from there...

Most of the time though you just create a query and use SPI_exec. Then
you don't actually have to worry about details like names of the
indexes, OIDs, types, comparison functions, etc...

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Goodenough 2006-02-17 10:16:20 Implicit conversion from string to timestamp
Previous Message Chad 2006-02-17 09:06:16 Re: How do I use the backend APIs