Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8809551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:54:16+00:00 2026-06-14T02:54:16+00:00

I’m writing an extension for PostgreSQL in C and I need to use hstore

  • 0

I’m writing an extension for PostgreSQL in C and I need to use hstore in my UDFs. I can build without errors (using pgxc) but can’t use any function in SQL queries.

I’ve tried PG_LIBS=hstore but got undefined reference errors while loading the library.

Next try was SHLIB_LINK=-L/usr/lib/postgresql/9.1/lib -lhstore (libhstore.so is not present in the system, only hstore.so, so i’ve tried with sym and hard links) and got

psql:libname.sql:69: ERROR:  could not load library
"/usr/lib/postgresql/9.1/lib/libname.so": libhstore.so: cannot open shared 
object file: No such file or directory
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:54:18+00:00Added an answer on June 14, 2026 at 2:54 am

    From memory, hstore doesn’t expose much of a C API. You have to use it via the server programming interface (SPI), using its SQL-level interfaces via your C extension. UPDATE: Or, as Tom Lane points out on the mailing list, use the fmgr to invoke the SQL functions it exposes, rather than using the SPI to run full SQL statements. UPDATE2: Another option is to load_external_function("extension", "symbol") the C functions directly; see fmgr.h.

    Most of the functions you’re trying to use in hstore will be declared static (so they’re local to the hstore module) which is probably why you’re getting undefined references. You can only use what’s declared in hstore.h as a macro or extern function. You can’t just call any function you find in (say) hstore_io.c via direct C linkage.

    PG_LIBS allows you to specify shared libraries to link to, but hstore.so isn’t a typical shared library that’s intended for linking to during compilation. It’s a PostgreSQL extension module that’s intended to be dlopen()ed by the server. I don’t think one extension module linking to another is really supported. That means you probably can’t even use the extern functions without quite a bit of hacking around.

    Use the SPI, the fmgr, or load_external_function.

    If using load_external_function you’re likely to need to manage memory contexts and other call context. Try to find examples of its use.

    See:

    • PGXS
    • Server programming interface (SPI)
    • fmgr
    • My question about this on pgsql-general
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I need to clean up various Word 'smart' characters in user input, including but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.