Postgresql – When running `make installcheck` I get can not connect to database

postgresql-extensionsUbuntu

On Ubuntu when I run make installcheck I'm getting

/usr/lib/postgresql/9.5/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/lib/postgresql/9.5/bin'    --inputdir=test --load-language=plpgsql --dbname=contrib_regression base math equality
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
command failed: "/usr/lib/postgresql/9.5/bin/psql" -X -c "DROP DATABASE IF EXISTS \"contrib_regression\"" "postgres"
/usr/lib/postgresql/9.5/lib/pgxs/src/makefiles/pgxs.mk:272: recipe for target 'installcheck' failed
make: *** [installcheck] Error 2

What's the reason for this?

This is on the pg-bignum extension.

Best Answer

If you're trying to build an extension on Ubuntu, you may have to set the port to isolate which version of PostgreSQL you wish to test the extension on with PGPORT. You can see here make install check is connecting on 5433 with the socket name .s.PGSQL.5432,

You likely want port 5432

make PGPORT=5433 installcheck