psql: symbol lookup error: psql: undefined symbol: PQsetErrorContextVisibility

橙三吉。 提交于 2021-02-09 09:17:36

问题


I switched my postgres version from 9.2.24 to 9.6 because I need jsonb compatibility along with other recent features. I am running a vm on centos 7.

I decided to wipe all existing instances of postgres (which are almost empty since it is staging) and then installed 9.6. However, once I enter the postgres shell I received the following error when I type psql:

psql: symbol lookup error: psql: undefined symbol: PQsetErrorContextVisibility

I assume I need to change the path that psql is looking for so that it connects properly but I am not sure where to point it.

Note: ls reveals 2 directories and 1 file in postgres bash 9.6 data and initdb.log.


回答1:


psql: symbol lookup error: psql: undefined symbol: PQsetErrorContextVisibility

That means your copy of psql is looking for a dynamic symbol in libpq.so which the version in your path does not have.

Do you have a custom compiled version of psql? And, if so, you'll have to build it against the newer libpq that 9.6 provides.




回答2:


Just faced this because of red hat SCL. I got away with the following.

ln -s /opt/rh/rh-postgresql96/root/usr/lib64/libpq.so.rh-postgresql96-5.9 /opt/rh/rh-postgresql96/root/usr/lib64/libpq.so.5

ln -s /opt/rh/rh-postgresql96/root/usr/lib64/libpq.so.5 /usr/lib/libpq.so.5

In wouldn't advise my worst enemy about using software coming from SCL repository in place of an external repo (see postgresql 96 on centos 7).




回答3:


Try

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<your postgres lib directory>

For example

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/ 

(turning @vaotsun's comment into an answer)



来源:https://stackoverflow.com/questions/52303275/psql-symbol-lookup-error-psql-undefined-symbol-pqseterrorcontextvisibility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!