问题
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.12old server UBUNTU 16 LTS
psql --version
= 12.2 (but SQL is 10.12!)pgxn
installed bysudo easy_install pgxnclient
.
redo bysudo -H pip install --upgrade pgxnclient
pgxn --version
= pgxnclient 1.3for
json_fdw
package prepared, before pgxn install, with sucesssudo 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