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.

  1. I tried the old fashion way to change environmental variables. I had the following added to /etc/environment:



Now, in my non-admin PostreSQL account,

SELECT short_name, long_name FROM ST_GdalDrivers();

returns 0 rows, meaning no GDAL drivers are enabled.

  1. 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"
  1. 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


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

2 Answers 2


Edit the /etc/postgresql/9.x/main/environment file and set following environment variables POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL POSTGIS_ENABLE_OUTDB_RASTERS=1. Restart then the server.


Debugging first, do this.

  1. SET postgis.gdal_enabled_drivers = 'ENABLE_ALL';
  2. SELECT * FROM ST_GdalDrivers();

If this returns nothing, you've got larger issues. Did you install from the Ubuntu/LUbuntu repos? Or, did you build yourself?

ALTER SYSTEM is the new method to alter the configuration file with a pseudo-sql command. If you're seeing this

ERROR: unrecognized configuration parameter "postgis.gdal_enabled_drivers"

That means that you do not have that option in your postgresql.conf. (perhaps it's commented out.) That however you can still add it the conf file manually.

A configuration option to set the enabled GDAL drivers in the PostGIS environment. Affects the GDAL configuration variable GDAL_SKIP. This option can be set in PostgreSQL's configuration file: postgresql.conf. It can also be set by connection or transaction.

ALTER SYSTEM SET postgis.gdal_enabled_drivers TO 'GTiff PNG JPEG';

or to whatever you want. I would not set the environment. Instead, just put this in your /etc/postgresql/9.5/main/postgresql.conf

postgis.gdal_enabled_drivers = 'ENABLE_ALL';

Which is essentially the same as what the docs say,

SET postgis.gdal_enabled_drivers = 'ENABLE_ALL';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.