Michael Stoner
Michael Stoner

Reputation: 900

Postgresql ERROR: could not load library plpgsql.so undefined symbol

My Postgresql installation is working, but when I call a particular function I get an undefined symbol HeapTupleHeaderGetDatum, and plpgsql.so will not load.

This is going to be a Question and Answer, the reason for this Q&A is that the current answers here don't turn up in google search results and I hope this will help others

Upvotes: 1

Views: 7860

Answers (2)

Michael Stoner
Michael Stoner

Reputation: 900

Restart the Postgresql database,

You've changed versions of postgresql and forgotten to restart.

This can be checked by running postgres --version from the host

$ postgres --version 
postgres (PostgreSQL) 9.1.15

Vs. select version(); from the psql prompt:

pg=# select version();

                         version
PostgreSQL 9.1.12 on x86_64-suse-linux-gnu, compiled by ....

Upvotes: 8

Craig Ringer
Craig Ringer

Reputation: 324275

A more likely cause of this for many people will be that the libpq found by the dynamic linker is older than the one a client program like psql was compiled against. ldd psql (or whatever the problem client is) will usually help indicate if this is the case.

BTW, it's not a great idea to hot-replace the binaries. Better to stop the server, replace the binaries, and start the server. This is true of most things on Linux. You can replace the binaries, but unless they're utterly 100% binary compatible kaboom may result. Even then it's only safe-ish if you unlink() (e.g. rm) the old binaries, then create the new ones. If you overwrite in-place you'll modify the memory-mapped binary backing running code, which will have exciting and colourful results.

Upvotes: 1

Related Questions