I am testing an example for creating a simple base36 PostgreSQL extensions.
However, I run into problems when writing and using the unit test case (REGRESS =
). If I use sudo make installcheck
, there will be an error saying
... ============== dropping database "contrib_regression" ==============
psql: FATAL: role "root" does not exist ... ...
It seems that PostgreSQL is trying to use the current login user to perform the test, which in this case does not exist. If I omit the sudo
and just do make installcheck
, it will generate a different error saying permission denied
for something
CREATE DATABASE ERROR: permission denied to set parameter "lc_messages" command failed: "/usr/lib/postgresql/9.5/bin/psql" -X -c "ALTER DATABASE \"contrib_regression\" SET lc_messages TO 'C';ALTER DATABASE \"contrib_regression\" SET lc_monetary TO 'C';ALTER DATABASE \"contrib_regression\" SET lc_numeric TO 'C';ALTER DATABASE \"contrib_regression\" SET lc_time TO 'C';ALTER DATABASE \"contrib_regression\" SET timezone_abbreviations TO 'Default';" "contrib_regression" /usr/lib/postgresql/9.5/lib/pgxs/src/makefiles/pgxs.mk:272: recipe for target 'installcheck' failed make: *** [installcheck] Error 2
My questions are:
Can I specify a different user (such as a superuser) in the Makefile
for the PostgreSQL extension?
Or, can I solve the problem so that a non-superuser can perform the installcheck
?
Note: the Makefile
is:
EXTENSION = base36 # the extensions name
DATA = base36--0.0.1.sql # script files to install
REGRESS = base36_test # our test script file (without extension)
# postgres build stuff
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)