Using hstore, json, lo, etc from C extensions?

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Using hstore, json, lo, etc from C extensions?
Дата
Msg-id 509C9D42.8090003@2ndQuadrant.com
обсуждение исходный текст
Ответы Re: Using hstore, json, lo, etc from C extensions?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi all

With the growing number of extensions that expose useful and increasingly widely used custom data types, I'm wondering: is there any way to use them from a C extension without going through the SPI?

A look at the sources for hstore and json shows that they mostly define static functions and don't present much of an external C API. But say they did; if I or someone else wrote a proper C level API for use of hstore from other C extensions. Is there any way to actually link to it and use it from another C extension?

It looks like extensions can use `requires` to express dependencies on each other ( http://www.postgresql.org/docs/current/static/extend-extensions.html) ... but is there any way to express a *linkage* dependency for C-level use, to actually link to hstore and use its non-static functions?

As far as I can tell the only way to do it at the moment would be to extract most of the guts from the `hstore` extension into a `libhstore` that both the hstore extension and other extensions could link to. There doesn't seem to be provision for doing that in the extension building infrastructure, so it seems it'd be a manual hackjob.

I realise you can still use other extensions via the SPI, I'm just wondering about direct C level usage for performance critical or specialized tasks. With the growing popularity of hstore, the interest in json, etc, this is likely to start coming up more.

Question originally prompted by this SO post: http://stackoverflow.com/questions/13302682/postgresql-udf-in-c-using-hstore

--
Craig Ringer

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Does PostgreSQL have complete functional test cases?
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Running out of memory while making a join