How to install pgxn with correct PostgreSQL version?

若如初见. 提交于 2020-03-25 22:01:17

问题


On sudo -H pgxn install semver, ERROR about wrong PostgreSQL version (it is v10 not v12),

INFO: best version: semver 0.20.3
INFO: saving /tmp/tmpba6hta5a/semver-0.20.3.zip
INFO: unpacking: /tmp/tmpba6hta5a/semver-0.20.3.zip
INFO: building extension
gcc -Wall -Wmissing-prototypes -Wpointer-arith... src/semver.c: In function ‘tail_cmp’:
src/semver.c:440:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   char *dot = ".";
   ^
gcc -Wall -Wmissing-prototypes -...
/usr/bin/install -c -m 644 .//doc/semver.mmd '/usr/share/doc/postgresql-doc-12/extension/'

INFO: installing extension
/bin/mkdir -p '/usr/share/postgresql/12/extension'
/bin/mkdir -p '/usr/share/postgresql/12/extension'
/bin/mkdir -p '/usr/lib/postgresql/12/lib'
/bin/mkdir -p '/usr/share/doc/postgresql-doc-12/extension'
/usr/bin/install -c -m 644 .//semver.control '/usr/share/postgresql/12/extension/'
/usr/bin/install -c -m 644 .//sql/semver--0.20.0.sql ...

I try also to fix "postgresql headers", by this clue using sudo apt install postgresql-server-dev-10, but no effect.

I was using the pgxn.org extensions, that has no obvious "installation Guide" on its home. Seems that the Guide is pgxn.github.io/pgxnclient, but it say nothing about change PostgreSQL configs (but Pg Guide about extend-pgxs perhaps say something).


More details on json_fdw/issues and this other question.


ENV details

  • on psql "postgres://postgres:passwd@localhost/myBase" -c "select version()" = PostgreSQL 10.12

  • old server UBUNTU 16 LTS

  • psql --version = 12.2 (but SQL is 10.12!)

  • pgxn installed by sudo easy_install pgxnclient.
    redo by sudo -H pip install --upgrade pgxnclient
    pgxn --version = pgxnclient 1.3

  • for json_fdw package prepared, before pgxn install, with sucess sudo apt install zlib1g-dev libyajl-dev.

Seems the real problem is a PostgreSQL version confusion: the two exists, ls /usr/share/postgresql/10/extension and ls /usr/share/postgresql/12/extension


回答1:


The installation worked fine, the warning is about a code bug in semver.

The extension is built and installed with the PostgreSQL v12 installation on your machine, because the pg_config found on the PATH is the one from v12. If you want to build and install the extension with v10, make sure the pg_config from v10 is first on the PATH.



来源:https://stackoverflow.com/questions/60616416/how-to-install-pgxn-with-correct-postgresql-version

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