rt_raster_to_gdal: Could not load the output GDAL driver I have already set the environment in windows 

SET postgis.gdal_enabled_drivers = 'ENABLE_ALL';


Even I tried by adding following in environment path-

POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL


But still I am getting error:


  ERROR: rt_raster_to_gdal: Could not load the output GDAL driver SQL


The query I am running is 

SELECT ST_AsGDALRaster(rast, 'GTiff') As rastjpg
FROM myRaster WHERE rid=1;


How to remove this issue?
It seems likely that you're not using PostGIS 2.2.

Pay special attention to postgis.enable_outdb_rasters.

Taken from my answer on GIS.SE



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 GUC, you must set them on the command line,


  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.