Re: plugin dev, oid to pointer map

From: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>
To: Attila Soki <atiware(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: plugin dev, oid to pointer map
Date: 2016-05-30 00:43:16
Message-ID: a411524a-fd29-9ef2-b2cc-9dcf3756bc42@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 29/05/2016 22:10, Attila Soki wrote:
> Hi all,
>

Hello,

> i am about to begin with postgresql plugin development.
>H Currently i'm trying to become somewhat familiar with the postgresql sources.

>
> Without going too deep into details about the plugin, i want to use
> many Oid to pointer relations.
> The pointer is a pointer to my own struct (allocated with palloc).
> There will be approx. 1000 unique oid/pointer pairs.
>
> Basically, what i want is, to be able to get the pointer to my struct by Oid.
>
> Is there is a suitable hashmap or key-value storage solution in the pg code?
> if so, please point me to the right part of the source.
>

Yes, there's an hashtable implementation, see dynahash.c

If you want to use that in shared memory in your extension, you can look
at the pg_stat_statements extension (look for pgss_hash) for an example.

Regards.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2016-05-30 03:51:17 Re: [GENERAL] Permission Denied Error on pg_xlog/RECOVERYXLOG file
Previous Message Attila Soki 2016-05-29 20:10:04 plugin dev, oid to pointer map