<div dir="ltr"><div dir="ltr"><div>I have a PostGIS connection string that works fine in GDAL, as I get a raster response when running</div><div>---</div><div><font face="monospace, monospace">gdalinfo "PG:host=... port=5432 user='...' password='...' dbname='weather_models' schema='rasters' table='wpc_snow_50pct_1551268800' column='rast' mode=1 where='timestamp=\'2019-03-02 00:00:00\''"</font></div><div>---</div><div><br></div><div>On this very same server, I have cgi-mapserver running, and the output from /usr/lib/cgi-bin/mapserv/ -v is</div><div>---</div><div><font face="monospace, monospace">MapServer version 7.2.1 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE</font></div><div>---</div><div><br></div><div>The problem is, when I use that same PG:... connection string as the DATA for a LAYER in MapServer, I get an unhelpful error:  <font face="monospace, monospace">Unable to access file. Corrupt, empty or missing file '<snip of PG connection string>' Couldn't establish a database connection.</font></div><div><br></div><div>Despite turning DEBUG level to 5, and CPL_DEBUG to ON in the MAP block of my mapfile, I don't get any helpful debug information whatsoever in my error log -- just the connection string and "Couldn't establish a database connection." I have tried a variety of where clauses and other tables and get the same result. I have no idea if the actual error is coming from GDAL or MapServer, despite all those strings working fine when running them directly via GDAL.</div><div><br></div><div>By the way, it's the same error whether I use 'timestamp'= or timestamp=.</div><div><br></div><div>Here is the mapfile:</div><div>---</div><div><font face="monospace, monospace">MAP</font></div><div><font face="monospace, monospace"> CONFIG "MS_ERRORFILE" "/map/error.txt"</font></div><div><font face="monospace, monospace"> CONFIG "CPL_DEBUG" "ON"</font></div><div><font face="monospace, monospace"> DEBUG 5</font></div><div><font face="monospace, monospace"> PROJECTION</font></div><div><font face="monospace, monospace">  "init=epsg:4326"</font></div><div><font face="monospace, monospace"> END</font></div><div><font face="monospace, monospace"> LAYER</font></div><div><font face="monospace, monospace">  NAME wpc_snow_50pct</font></div><div><font face="monospace, monospace">  TYPE RASTER</font></div><div><font face="monospace, monospace">  STATUS ON</font></div><div><font face="monospace, monospace">  VALIDATION</font></div><div><font face="monospace, monospace">   "timestamp" ".*"</font></div><div><font face="monospace, monospace">  END</font></div><div><font face="monospace, monospace">  PROJECTION</font></div><div><font face="monospace, monospace">   "init=epsg:4326"</font></div><div><font face="monospace, monospace">  END</font></div><div><font face="monospace, monospace">  METADATA</font></div><div><font face="monospace, monospace">   "wms_title" "wpc_snow_50pct"</font></div><div><font face="monospace, monospace">   "wms_srs"   "EPSG:4326"</font></div><div><font face="monospace, monospace">   "wms_extent" "-108.5 41 -104.5 36"</font></div><div><font face="monospace, monospace">   "wms_enable_request" "*"</font></div><div><font face="monospace, monospace">  END</font></div><div><font face="monospace, monospace">  DATA "PG:host=... port=5432 dbname='weather_models' user='...' password='...' schema='rasters' table='wpc_snow_50pct_1551268800' column='rast' mode=1 where='timestamp=\'2019-03-02 00:00:00\''"</font></div><div><font face="monospace, monospace">  PROCESSING "BANDS=1"</font></div><div><font face="monospace, monospace"> END</font></div><div><font face="monospace, monospace">END</font></div><div><font face="arial, helvetica, sans-serif">---</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Any help is appreciated!<br><br>Thanks,<br>Thomas</font></div></div></div>