I am trying to set a global setting/GUC variable postgis.gdal_enabled_drivers
from the PostGIS
extension for a while. I am a non-admin user but can ask admin to change settings if needed. But I tried several different methods following the instructions but none worked.
-
I tried the old fashion way to change environmental variables. I had the following added to
/etc/environment
:POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL
so that echo $POSTGIS_GDAL_ENABLED_DRIVERS
returns ENABLE_ALL
Now, in my non-admin PostreSQL account,
SELECT short_name, long_name FROM ST_GdalDrivers();
returns 0 rows
, meaning no GDAL drivers are enabled.
-
I also tried to have postgres to:
ALTER SYSTEM SET postgis.gdal_enabled_drivers TO 'ENABLE_ALL';
but I got an error:
ERROR: unrecognized configuration parameter "postgis.gdal_enabled_drivers"
-
I tried to:
ALTER DATABASE my_db SET postgis.gdal_enabled_drivers TO 'ENABLE_ALL';
but I got:
ERROR: permission denied to set parameter "postgis.gdal_enabled_drivers"
In sum, I can ask admin to change some settings once as in methods 1 and 2, but not every time e.g. when I do a full database restore (method 3).
My question is:
How can I make the above methods work?
FYI, my PostgreSQL version is 9.5.1, OS is Lubuntu 16.04 beta
postgis_version
---------------------------------------
2.2 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
In method 3, I can use postgres
to ALTER DATABASE
but I can't ask amin to do that every time I restore db, where I do something like:
dropdb my_db && createdb -T template my_db $$ psql < my_pg_dump_file
Best Answer
Edit the
/etc/postgresql/9.x/main/environment
file and set following environment variablesPOSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL
POSTGIS_ENABLE_OUTDB_RASTERS=1
. Restart then the server.