I have seen a number of posts similar to this but with no resolution.

I am experimenting with GDAL commands and am fairly new to it however when using a PostgreSQL database connection I am getting the following errors:

FAILURE: Unable to open datasource `PG:host= port=5432 dbname=postgres user=postgres password=*******' with the following drivers. (Lists all drivers)


ERROR 1: Unable to find driver `PostgreSQL

ogr2ogr -overwrite -update -f PostgreSQL PG:"dbname='cadcorp' host='localhost' port='5432' user='postgres' password='********'" C:\Users\tommyh\Desktop\data\merged.shp -nlt POLYGON -nln gdaltestupload -progress

when I run gdalinfo --formats the list doesn't PostgreSQL so I guess I can see why the PostgreSQL connection isn't working compared to when I use a SQL Server connection MMSQLSpatial which is in the formats list.

I have set the environment variables:

GDAL_DATA=C:\Program Files\GDAL\gdal-data

GDAL_DRIVER_PATH=C:\Program Files\GDAL\gdalplugins

My GDAL version is:

gdalinfo --version GDAL 2.2.3, released 2017/11/20

Running through the command prompt on Windows 10.

Any ideas on what I may be missing or need to do?

  • Do have installed postgres on your machine = localhost? – Kurt Feb 8 '19 at 16:32
  • @kurt Yes, I have also tried with – Hutch Feb 8 '19 at 18:06
  • did you install the postgres-server-software from postgresql.org on your machine? – Kurt Feb 8 '19 at 18:37
  • 1
    gdalinfo --formats is listing the raster drivers, check ogrinfo --formatsinstead. – user30184 Feb 10 '19 at 17:21
  • 1
    @user30184 I think I will have to, I am still curious as to why my installs do not include the "PostgreSQL" driver. But yes I guess I will use OSGeo4 for now. Thank you for your time. – Hutch Feb 11 '19 at 10:20

Your Answer

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

Browse other questions tagged or ask your own question.