I've seen this question several times, but I'm not 100% sure what needs to happen for my situation. Quite often the answer is to install OpenGEO4W & GDAL, but it appears I already have GDAL.

I just did a fresh install of the all in one PostgreSQL and PostGIS windows installer. PostGIS seems to be working quite fine. I'm attempting to use the ogr2ogr utility to ultimately migrate geo tables into a SpatiaLite database. I only found the OGR exectubles in one spot and that is in the pgsql bin folder.

ogr2ogr --version results in this:

GDAL 3.2.0, released 2020/10/26

To simplify this I can generate the error I'm getting by running ogrinfo and attempt to connect to my local pgsql host, like so:

\database\PostgreSQL\13\bin>ogrinfo PG:"host= port=5432 user='postgres' password='blablabla' dbname='postgis_30_sample'"

And the instant outcome is this:

Unable to open datasource `PG:host= port=5432 user='postgres' password='blablabla' dbname='postgis_30_sample'' with the following drivers.
  -> ESRIC
  -> PDS4
  -> VICAR
  -> JP2OpenJPEG
  -> PDF
  -> MBTiles
  -> EEDA
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> LVBAG
  -> S57
  -> DGN
  -> OGR_VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> GML
  -> GPX
  -> KML
  -> GeoJSON
  -> GeoJSONSeq
  -> TopoJSON
  -> OGR_GMT
  -> GPKG
  -> SQLite
  -> ODBC
  -> WAsP
  -> PGeo
  -> MSSQLSpatial
  -> OpenFileGDB
  -> XPlane
  -> DXF
  -> CAD
  -> FlatGeobuf
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> OSM
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> OGR_PDS
  -> WFS
  -> OAPIF
  -> HTF
  -> AeronavFAA
  -> Geomedia
  -> SVG
  -> CouchDB
  -> Cloudant
  -> Idrisi
  -> SEGY
  -> XLS
  -> ODS
  -> XLSX
  -> Elasticsearch
  -> Walk
  -> Carto
  -> AmigoCloud
  -> SXF
  -> Selafin
  -> JML
  -> CSW
  -> VDV
  -> MVT
  -> NGW
  -> MapML
  -> TIGER
  -> AVCBin
  -> AVCE00
  -> HTTP

So, Is OpenGEO4W needed? And what install? It seems like the standard install is a large suite of tools? It is confusing to me that the instance packaged with the PgSQL install doesn't have the driver necessary to connect to PgSQL. Is there a way to simply add the PgSQL driver for ogr?

  • Welcome to GIS SE ! On which platform are you ? If windows, it seems that the compiled GDAL that you installed haven't the 'PostgreSQL' driver. Dec 27, 2020 at 19:44
  • Try localhost instead of 127
    – Ian Turton
    Dec 27, 2020 at 20:24
  • 1
    @J.Monticolo I am on windows. The windows installer handled installing the optional utilities as part of the install process, so I guess I had hopes that it would have defaulted to including the PostGreSQL driver, but perhaps the default binary install doesn't have it.
    – slambeth
    Dec 27, 2020 at 21:04
  • Try it without the single quotes: \database\PostgreSQL\13\bin>ogrinfo PG:"host= port=5432 user=postgres password=blablabla dbname=postgis_30_sample"
    – jbalk
    Jan 7, 2021 at 21:19
  • Also if you're on windows and having problems with GDAL, you should check out miniconda. It has a good gdal package that always works for me.
    – jbalk
    Jan 7, 2021 at 21:25

1 Answer 1


In my case, specifically setting the output format and quoting every connectionstring component did the trick:

ogrinfo -f PostgreSQL PG:"host='' port='5432' user='postgres' password='blablabla' dbname='postgis_30_sample'"

This was on Windows, using the GDAL 3.6.2 version that comes bundled inside QGIS OSGeo4W (by default installed on C:\Program Files\QGIS 3.28.3)

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.