I try to install semver on my Postgresql 12. I installed postgis successfully and used following command to install pg-semver (semver extension) on my Centos 7 server:
yum install pg-semver
Then i ran
CREATE EXTENSION semver;
I got following error:
couldn’t open extension control file
/usr/pgsql-12/share/extension/semver.control : No such file or
directory
I copied all files from “/usr/share/pgsql/extension/” to “/usr/pgsql-12/share/extension”. Now I’m getting following error:
ERROR: ERROR: could not access file “semver”: No such file or
directory
UPDATE (28.02.2020):
I removed pg-semver because it delivers for PSQL 9.2. I try to now build itself by using the documentation which developer provided.
I downloaded the semver extension from https://github.com/theory/pg-semver/archive/master.zip and then unzipped. After that I run following command:
make
and get:
make: There is nothing to do for the “all” target.
then:
make install
and get:
/bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c
-m 644 ./semver.control ‘/usr/share/pgsql/extension/’ /bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c -m 644
./sql/semver–0.20.0.sql ./sql/semver–unpackaged–0.2.1.sql
./sql/semver–0.20.0–0.21.0.sql ./sql/semver–0.12.0–0.13.0.sql
./sql/semver–0.3.0–0.4.0.sql ./sql/semver–0.16.0–0.17.0.sql
./sql/semver–0.13.0–0.15.0.sql ./sql/semver–0.11.0–0.12.0.sql
./sql/semver–0.2.4–0.3.0.sql ./sql/semver–0.2.1–0.2.4.sql
./sql/semver–0.5.0–0.10.0.sql ./sql/semver–0.10.0–0.11.0.sql
./sql/semver.sql ./sql/semver–0.17.0–0.20.0.sql
./sql/semver–0.15.0–0.16.0.sql ‘/usr/share/pgsql/extension/’
/bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c
-m 755 src/semver.so ‘/usr/lib64/pgsql/’ /bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c -m 644
./doc/semver.mmd ‘/usr/share/doc/pgsql/extension/’
then:
make installcheck
and get:
============== dropping database “contrib_regression” ============== DROP DATABASE
============== creating database “contrib_regression” ============== CREATE DATABASE ALTER DATABASE
============== installing plpgsql ============== CREATE LANGUAGE
============== running regression test queries ============== test base … FAILED (test process exited with
exit code 3)————— 1 of 1 tests failed.
The differences that caused some tests to fail can be viewed in the
file “/tmp/ttt/pg-semver-master/regression.diffs”. A copy of the test
summary that you see above is saved in the file
“/tmp/ttt/pg-semver-master/regression.out”.make: *** [installcheck] Error 1
the content of regression.out:
…… ! ok 278 – minor version check ! ok 279 – Function
get_semver_patch() should exist ! ok 280 – semver ! ok 281 – Function
get_semver_patch() should return integer ! ok 282 – patch version
check ! ok 283 – Function get_semver_prerelease() should exist ! ok
284 – semver ! ok 285 – Function get_semver_prerelease() should return
text ! ok 286 – prerelease label check ! ok 287 – 1.0.0 should be in
range [1.0.0, 2.0.0] ! ok 288 – 1.0.0 should not be in range [1.0.1,
2.0.0] ! ok 289 – 2.0.0 should not be in range [1.0.1, 2.0.0) ! ok 290 – 1.9999.9999 should be in range [1.0.1, 2.0.0) ! ok 291 – 1000.0.0 should be in range [1.0.0,) ! ok 292 – Should be able to work with
arrays of semverranges
— 1,2 —- set ECHO none ! psql:sql/semver.sql:30: ERROR: could not access file “semver”: No such file or directory
There is no semver.so in /usr/pgsql-12/lib/, there is a semver.so in /usr/lib64/pgsql/ but it’s also for version 9.2 ?
2
Answers
Follow this guide to install semver:
https://pgxn.org/dist/semver/
The reason why you are unable to install
semver
is twofold:You are getting the error
could not access file "semver": No such file or directory
because you didn’t copy/usr/lib64/pgsql/semver.so
to/usr/pgsql-12/lib
. However, you can’t simply copy that over because of this following second reason:yum install pg-semver
will installsemver
from the EPEL library, which is the pre-packaged PostgreSQL version 9.2 that is shipped with CentOS 7. You installed PostgreSQL version 12 (either by compiling it yourself or downloading the PGDG repo and installing thepostgresql12
package). Thesemver.so
file that is shipped with the EPEL repo is not compatible, as it was compiled against PostgreSQL version 9.2, not version 12. If you attempt to load the EPELsemver.so
into your v.12 database, you will see:Therefore, the only way for you to install
semver
is by following the compilation steps detailed in the documentation:If you have not done so already (and you installed postgresql 12 via PGDG RPM), you will need to do the following in order to download and compile:
You may also run into issues with compilation, like:
clang: error: unknown argument: '-flto=thin'
because the PGDG RPM was compiled withclang
— you can bypass that by doing:Disclosure: I work for EnterpriseDB (EDB)