Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux