I have problem of loading GDAL in PostGIS

SET postgis.gdal_enabled_drivers = 'ENABLE_ALL';

After running

  SET postgis.gdal_enabled_drivers
  TO 'GTiff PNG JPEG';`  

I still have an error:

rt_raster_to_gdal: Could not load the output GDAL driver

Note that command gdalinfo works. Here is the result executing postgis_full_version() in pgadmin:

POSTGIS="2.1.7 r13414" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.1, released 2014/09/24 GDAL_DATA not found" LIBXML="2.7.8" LIBJSON="UNKNOWN" TOPOLOGY RASTER

3 Answers 3


Run this SQL command:

SET postgis.gdal_enabled_drivers = 'ENABLE_ALL';

As explained in the PostGIS blog,

This has been an issue since our release of 2.0.6/2.13 PostGIS security patches that by default disabled all raster drivers and out-of-db raster storage. Raster is much less useful if you don’t have any raster drivers enabled, so you need to renable them or the selective ones you need.

The interface you're using is referred to as Grand Unified Custom Variables (GUC). It's a PostGIS 2.2 thing. If using PostGIS 2.1, you do not have GUC, you must set environmental variables corresponding to those options,

As of PostGIS 2.1.3, out-of-db rasters and all raster drivers are disabled by default. In order to re-enable these, you need to set the following environment variables POSTGIS_GDAL_ENABLED_DRIVERS and POSTGIS_ENABLE_OUTDB_RASTERS in the server environment.


Maybe you don't have installed the PostGIS extension. If you use Linux try this command to check that the package is installed:

apt list --installed | grep postgis

If the result is null install PostGIS using this command:

sudo apt-get install postgis

  • I don't believe that the PostgreSQL DB would know about any GDAL driver unless the PostGIS extension has been activated. Commented Aug 10, 2023 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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