0

The simplest command, to check a package, for example pgxn check json_fdw, is not working:

INFO: best version: json_fdw 1.0.0
INFO: saving /tmp/tmpwblehzox/json_fdw-1.0.0.zip
INFO: unpacking: /tmp/tmpwblehzox/json_fdw-1.0.0.zip
INFO: checking extension
/usr/lib/postgresql/12/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/lib/postgresql/12/bin'    --dbname=contrib_regression basic_tests customer_reviews hdfs_block invalid_gz_file
(using postmaster on Unix socket, default port)
============== dropping database "contrib_regression" ==============
psql: error: could not connect to server: FATAL:  role "myUser" does not exist
command failed: "/usr/lib/postgresql/12/bin/psql" -X -c "DROP DATABASE IF EXISTS \"contrib_regression\"" "postgres"
/usr/lib/postgresql/12/lib/pgxs/src/makefiles/pgxs.mk:420: recipe for target 'installcheck' failed
make: *** [installcheck] Error 2
INFO: copying regression.out
INFO: copying regression.diffs
ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config installcheck

I need to express user, password, database, etc.

PS: the Guide link not exists, http://pgxnclient.projects.postgresql.org/

Usual for my env is to use psql connectionString (e.g. connectionString="postgres://postgres:passwd@localhost/byBase"), but pgxn not accepts it.


Other error example

sudo pgxn install json_fdw

INFO: best version: json_fdw 1.0.0
INFO: saving /tmp/tmpinndxvp9/json_fdw-1.0.0.zip
INFO: unpacking: /tmp/tmpinndxvp9/json_fdw-1.0.0.zip
INFO: building extension
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -pie -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal -I/usr/include/x86_64-linux-gnu -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o json_fdw.o json_fdw.c
In file included from json_fdw.c:15:0:
json_fdw.h:22:28: fatal error: nodes/relation.h: No such file or directory
compilation terminated.
<builtin>: recipe for target 'json_fdw.o' failed
make: *** [json_fdw.o] Error 1
ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config all

ENV details

  • old server UBUNTU 16 LTS

  • psql --version = 12.2

  • pgxn installed by sudo easy_install pgxnclient. pgxn --version = pgxnclient 1.3

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

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

Peter Krauss
  • 13,174
  • 24
  • 167
  • 304

1 Answers1

1

The documentation is here. It says:

pgxn check

Run a distribution’s unit test.

Usage:

pgxn check [--help] [--stable | --testing | --unstable]
           [--pg_config PROG] [--make PROG]
           [-d DBNAME] [-h HOST] [-p PORT] [-U NAME]
           SPEC

The command takes a package specification identifying the distribution to work with, which can also be a local file or directory or an URL. The distribution is unpacked if required and the installcheck make target is run.

make installcheck is documented in the PostgreSQL documentation:

The scripts listed in the REGRESS variable are used for regression testing of your module, which can be invoked by make installcheck after doing make install. For this to work you must have a running PostgreSQL server.

So you need to have a PostgreSQL database running, and you have to specify database name, host, port and user if you don't want to use the defaults. Since the user will typically create an extension, it will usually have to be a superuser.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
  • Hi, thanks the correct links and all explanations (!). I am using `pgxn check -d mybase -h localhost -U postgres json_fdw` but two problems: 1. it say *"dropping database 'mybase'"* (the command is not to drop a database!); 2. I need to use interactive (keyboard) password, but error, *"FATAL: password authentication failed; .. password retrieved from file "/home/myUser/.pgpass"*. – Peter Krauss Mar 09 '20 at 14:45
  • `-d` specifies the regression test database. It is created as part of the test run, so don't use a database that contains data you need. – Laurenz Albe Mar 09 '20 at 14:48
  • Oops, ok, now testing `sudo pgxn install json_fdw`... But, see edited question (noew with ENV. etc. informations), there are also an error. – Peter Krauss Mar 09 '20 at 19:17
  • I am upvoting, but the problem persists, seems on my `pgxn` or my ENV. More details on [json_fdw bug-report #10](https://github.com/nkhorman/json_fdw/issues/10). – Peter Krauss Mar 09 '20 at 19:43
  • That means that you didn't install the PostgreSQL headers. Don't make this question into a "moving target" for your learning process. Rather, ask a new question if you encounter a new obstacle. – Laurenz Albe Mar 10 '20 at 03:28
  • Thanks @LaurensAlbe, I [asking here](https://stackoverflow.com/q/60616416/287948), and it not seem the "PostgreSQL headers", it is something confusing the pg version (pgxn say pgv12 but real is pgv10). – Peter Krauss Mar 10 '20 at 11:12